SQL语句理解 select * from B where (select count(1) as num from A where A.ID = B.ID) = 0
select * from B where (select count(1) as num from A where A.ID = B.ID) = 0
请问如何理解,为什么 可以在B表中 排除A表的数据
人气:385 ℃ 时间:2020-02-06 06:06:55
解答
子查询中select count(1) as num from A where A.ID = B.ID
就是统计B表和A表用ID连接的行数
子查询的行数=0,就可以实现从B表中排除A表数据子查询只是把计数传过去啊 主查询如何得知具体数据行?nono, 这么看:select * from B where ?= 0where中条件其实是,什么等于0?代入(select count(1) as num from A where A.ID = B.ID)就是A和B通过ID连接后,COUNT(*)计数=0select count(1) as num from A where A.ID = B.ID不等于0啊
推荐
猜你喜欢
- he sits () tom and mary 注 between不能用,因为我这里没有between选择
- 48,a,b,c,-12是等差数列中的连续五项,则a,b,c的值
- 八年级上册函数习题
- 当a的取值范围是_____时,级数∑n^2/a^n收敛,求解过程.
- 一个半圆和一个三角形(组合图形)半圆的直径是12厘米三角形是等腰直角三角形求面积
- 125×(8×4)=125×8+125×4=1000+500=1500对吗?
- many teachers don`t like their stuents to use e-mail english in their 什么english
- 趣味数学题,要有答案!