SELECT B.代号,B.NAME 
FROM B LEFT JOIN A ON B.NAME=B.NAME
WHERE A.NAME IS NULL

解决方案 »

  1.   


    SELECT B.代号,B.NAME 
    FROM B LEFT JOIN A ON B.NAME=A.NAME
    WHERE A.NAME IS NULL
      

  2.   

    SELECT * FROM TB WHERE NOT EXISTS
    (SELECT 1 FROM TA WHERE 项目 =TB.NAME)
      

  3.   

    select * from 表b b 
    where not exists(
    select * from 表a where name=b.name
    )
      

  4.   


    select a.* from a right join b on a.name=b.name
    where a.name is nullselect * from b where name not in(select name from a)select * from b where not exists(select 1 from a where a.name=b.name)
      

  5.   

    使用exists效率最高。
    select * from b where not exists(select 1 from a where a.name=b.name)
      

  6.   

    select * from b where not exists(select 1 from a where a.项目=b.name and a.代号=b.代号)