现有两个数据表:A(stu_id,name),B(id,stu_id),求A表中的stu_id不在B中的stu_id.求此SQL语句

zhangqy 2003-10-15 04:20:54
现有两个数据表:A(stu_id,name),B(id,stu_id),求A表中的stu_id没在B中的出现的stu_id.求此SQL语句
...全文
288 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangqy 2003-10-15
  • 打赏
  • 举报
回复
谢谢!
workhand 2003-10-15
  • 打赏
  • 举报
回复
select stu_id from A where stu_id not in (select distinct stu_id from B)
pengdali 2003-10-15
  • 打赏
  • 举报
回复
打个补丁:

select * form A where stu_id not in (select stu_id from B where stu_id is not null)
gmlxf 2003-10-15
  • 打赏
  • 举报
回复
select stu_id from A where stu_id not in (select stu_id from B)
pengdali 2003-10-15
  • 打赏
  • 举报
回复
select * form A where stu_id not in (select stu_id from B)
longji 2003-10-15
  • 打赏
  • 举报
回复
select stu_id from A where a.stu_id not in (select stu_id from B)

34,590

社区成员

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

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