select id from p1 where not exists(select id from p2)

解决方案 »

  1.   

    select p1.* from p1 left join p2 on p1.id=p2.id where p2.id is null
      

  2.   

    莱手报道:能这样写吗   select p1.id,p2.id  from p1,p2  where p1.id !=p2.id 多谢指教
      

  3.   

    莱手报道:能这样写吗   select p1.id,p2.id  from p1,p2  where p1.id !=p2.id 多谢指教
    ------------------
    不行,
    select id from p1 where not exists(select id from p2)
      

  4.   

    select id from p1 where not exists(select id from p2)
      

  5.   

    select id from p1 where id not in (select id from p2)