表t1:
字段:a
1
2
3
4
5表t2:
字段:b
1
2
3怎么得到表t1字段a 4 和5????谢谢了哈

解决方案 »

  1.   


    select a from t1 where not exists(select 1 from t2 where b = t1.a)
      

  2.   

    select t1.a from t1,t2 where t1.a<>t2.b
      

  3.   

    select t1.* from t1,t2 where a not in (t2.a)
      

  4.   


    select * from 表t1 t where not exists(select 1 from 表t2 where b=t.a)
      

  5.   


    或者:
    select a from t1  left join t2  on a=b where b is null
      

  6.   

    select a from t1 where a not in(select b from t2)