请大家帮助解决一个SQL 查询的问题!谢谢大家 表A 字段名称 A1 A2 A3 1 2 3 4 4 5表B 字段名称 B1 B2 B3 1 2 3 问题是: 如何根据表B 的数据列B1 查找出表A 中不同于表B的数据行 既要求结果显示: 表A A1 A2 A3 4 4 5 谢谢大家的帮助! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a.* from a left join b on a.a1=b.b1 and a.a2 = b.b2 and a.a3=b.b3 where b.b1 is null不知道这样行不行。 select t.a1, t.a2, t.a3from(select a.*, b.*from aleft join bon a1 = b1 and a2 = b2 and a3 = b3) twhere t.b1 is null select * from 表A where A1 not in(select B1 from 表B )手写的 如果是在2005及其以上版本,可以使用select * from a except select * from b 1.select a.*from a left join b on a1=b1 and a2=b2 and a3=b3where b1 is null [align=center]==== 思想重于技巧 ====[/align] reply via CSDN viewer 2.select * from awhere not exists ( select b1 from b where b1=a1 and b2=a2 and b3=a3) [align=center]==== 思想重于技巧 ====[/align] reply via CSDN viewer select * from A WHERE NOT EXISTS (SELECT 1 FROM B WHERE B1=A.A1 ) 3.select a1,a2,a3(select * from aunion allselect * from b)group by a1,a2,a3having count(*)=1 [align=center]==== 思想重于技巧 ====[/align] reply via CSDN viewer select * from a where a.a1 not in (select b1 from b) 谁有考勤管理的报表查询语句 查询每一年各雇用了多少员工。 小问题~ ado连接sql2000失败原因 这个句子该怎么写?? 存储过程sql语句拼合问题 插入新值的困惑!! 急!! 急!!!请教 sql-server的连接问题 sqlserver 查询数据量到达临界值 cpu 100% SQL关联表查询 SQL
from
(select a.*, b.*
from a
left join b
on a1 = b1 and a2 = b2 and a3 = b3) t
where t.b1 is null
select * from a except select * from b
from a left join b on a1=b1 and a2=b2 and a3=b3
where b1 is null
[align=center]==== 思想重于技巧 ====
[/align]
from a
where not exists ( select b1 from b where b1=a1 and b2=a2 and b3=a3)
[align=center]==== 思想重于技巧 ====
[/align]
(
select * from a
union all
select * from b
)
group by a1,a2,a3
having count(*)=1
[align=center]==== 思想重于技巧 ====
[/align]