select * from B where aid not in (select id from A),呵呵,只是支持子查询的数据库才能用.

解决方案 »

  1.   

    因为MySQL5.0以前不支持子查询(5.0以后也没试过),所以MySQL下这样写:
    select b.* from testb b left join test a on b.aid=a.id where a.name is null
      

  2.   

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

  3.   

    select * from B表 where aid not in(select id from A表)
      

  4.   

    MySQL: select b.* from testb b left join test a on b.aid=a.id where a.name is null
    MSSQL: select * from B where aid not in (select id from A)我特意装MySQL试了的,加分吧!
      

  5.   

    mysql: select B.* from B left join A on B.aid=A.id where A.name is null;
     小弟试过了!