当前位置: 代码迷 >> Sql Server >> 急死了,求救,高手帮忙,该如何处理
  详细解决方案

急死了,求救,高手帮忙,该如何处理

热度:123   发布时间:2016-04-27 21:41:02.0
急死了,求救,高手帮忙
怎样求这样一个集合,两个表假设结构如下
A表   AID     NAME       B表     BID       AID   NAME
          1       xxx                     1           1       xxx
          2       xxx                     2           1       xxx
想得到AID   =   2

就是说想得到A表中AID在B表中AID没有出现的数据集合

高手帮忙啊,十分感谢                  
                                                                     


------解决方案--------------------
Select * From A Where AID Not In (Select Disticnt AID From B)
------解决方案--------------------
Select A.*,B.* From A Left Join B On A.AID=B.AID
Where b.AID is Null
------解决方案--------------------
select * from a表 where AID not in(select AID from b表)
  相关解决方案