表1:
uname   uscore
 alex    100
 tom     90
 sam     90
表2:
uname   uscore
 john     100
 green    90查询表1中所有在表2中不存在的uname
咋办?

解决方案 »

  1.   

    select * from tb1 
    except 
    select * from tb2
      

  2.   

    select * from tb1 where not exists(select * from tb2 where uname=tb1.name)
      

  3.   


    select * from 表1
    where Uname not in (select uname from 表2)
      

  4.   

    select t1.* from t1 left join t2 on t1.uname=t2.uname where t2.uname is null
      

  5.   

    select * from 表1 where Uname not in (select uname from 表2)
      

  6.   

    select * from tb1 where not exist(select * from tb1.uname=tb2.uname)