一个SQL语句问题

supper3000 2003-08-19 09:26:02
有两个表,表A和表B,要查询所有表A中有ID表B中没有的记录,表B中的所有记录ID是表A的真子集。
...全文
18 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dafu71 2003-08-19
  • 打赏
  • 举报
回复
select * from 表A where not exists(select 1 from 表B where 表A.id=id)
hjb111 2003-08-19
  • 打赏
  • 举报
回复
select A.* from TableA A,TableB B where a.id<>b.id
pengdali 2003-08-19
  • 打赏
  • 举报
回复
select * from 表A where id not in (select id from 表B)

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧