有一表有两字段,两条记录,如1,a,  2,b,另一表有一个字段,一条记录,1,其中1与1关联,要求显示2,b这条记录,请问这条SQL语句如何写,谢谢

解决方案 »

  1.   

    select a.* from a where not exists(select 1 from b where a.col1=b.col1)
      

  2.   


    select a.* from a 
    where not exists(select 1 from b where a.col1=b.col1)
      

  3.   

    select  tb1.*  from tb1  where not  exists (select  1  from tb2 where tb1.col=tb2.col)
      

  4.   

    select  tb1.*  from  tb1 where  not  exists(select  1 from tb2 where tb1.col=tb2.col)
      

  5.   


    select a.* from a where not exists(select NULL from b where a.col1=b.col1)