帮忙写个select语句

yzyuanxin 2012-05-21 11:21:10
有一表有两字段,两条记录,如1,a, 2,b,另一表有一个字段,一条记录,1,其中1与1关联,要求显示2,b这条记录,请问这条SQL语句如何写,谢谢
...全文
78 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
anzhiqiang_touzi 2012-05-22
  • 打赏
  • 举报
回复

select a.* from a where not exists(select NULL from b where a.col1=b.col1)
yzyuanxin 2012-05-22
  • 打赏
  • 举报
回复
谢谢大家,万分感谢
以学习为目的 2012-05-22
  • 打赏
  • 举报
回复
select  tb1.*  from  tb1 where  not  exists(select  1 from tb2 where tb1.col=tb2.col)
以学习为目的 2012-05-22
  • 打赏
  • 举报
回复
select  tb1.*  from tb1  where not  exists (select  1  from tb2 where tb1.col=tb2.col)
  • 打赏
  • 举报
回复

select a.* from a
where not exists(select 1 from b where a.col1=b.col1)
百年树人 2012-05-21
  • 打赏
  • 举报
回复
select a.* from a where not exists(select 1 from b where a.col1=b.col1)

34,576

社区成员

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

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