Select * from m t1
where t1.p not in (Select distinct t2.m_p  from d t2) 

解决方案 »

  1.   

    select * from m where not exists(select 1 from d where m.p=d.m_p)
      

  2.   

    在oracle中也是一样的结果啊?
    demo@HASL>select * from m;         P M_
    ---------- --
             1 01
             2 02
             3 03demo@HASL>select * from d;        MP         D2 D3
    ---------- ---------- ----------
             1          1 01001
             1          2 01002
             1          3 01003
             2          4 02001
             2          5 02002demo@HASL>Select * from m where m.p not in (Select mp from d );         P M_
    ---------- --
             3 03