table aaid nametable bbid aid sex如何查 table a里在table b 里面没有 aid的列呢?

解决方案 »

  1.   

    select * from a
    except
    select * from b
      

  2.   

    select * from a
    where aid not in
    (select distinct aid from b)
      

  3.   


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

  4.   

    select a.* from a join b on a.aid=b.aid
      

  5.   

    Table a
    aid aname asex
    Table b
    bid aid bnameselect a.aid a.aname a.asex from a a, b b where a.aid<>b.aid这样可以查出来么