只需一步,快速开始
78
634
1598
管理员
方法一(仅适用单个字段) 使用 not in ,容易理解,效率低 select A.ID from A where A.ID not in (select ID from B) 方法二(适用多个字段匹配) 使用 left join...on... , "B.ID isnull" 表示左连接之后在B.ID 字段为 null的记录 select A.ID from A left join B on A.ID=B.ID where B.ID is null
方法三(适用多个字段匹配)
select * from B where (select count(1) as num from A where A.ID = B.ID) = 0
方法四(适用多个字段匹配)
select * from A where not exists(select 1 from B where A.ID=B.ID)
使用道具 举报
198
1313
3806
542
5916
1万
作者
本版积分规则 发表回复 回帖后跳转到最后一页
手机版|小黑屋|玉祥公司客服-玉祥集团客服 本站关键词:快速开发平台
GMT+8, 2024-5-6 11:45 , Processed in 0.124374 second(s), 28 queries .
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.