怎样找到符合的记录?

sam51 2001-12-17 02:42:19
表A:
AA BB
-----------
8 w
4 h
5 s
1 h

表B:
AA BB
-----------
5 e
6 p
8 w

如何从B表中找出第1,2条记录

条件:表B的AA字段内容不在表A的AA字段中,或者 表B的BB字段内容不在表A的BB字段中
...全文
27 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
昵称被占用了 2001-12-17
  • 打赏
  • 举报
回复
或者:
select * from b
where not exists (
select * from a where aa=b.aa
)
union
select * from b
where not exists (
select * from a where bb=b.bb
)

昵称被占用了 2001-12-17
  • 打赏
  • 举报
回复
select * from b
where not exists (
select * from a where aa=b.aa
)
or not exists (
select * from a where bb=b.bb
)
相关推荐
发帖
MS-SQL Server

3.4w+

社区成员

MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
帖子事件
创建了帖子
2001-12-17 02:42
社区公告
暂无公告