select * from b where month='200301' and useid not in(
select id from a)

解决方案 »

  1.   

    select A.name,b.* 
    from a,b 
    where a.id(+) = b.userid 
      and b.month   = '200301'
      

  2.   

    select A.name,b.* from a,b where a.id=b.userid and b.month='200301';
      

  3.   

    查多出来的两条
    select * from a,b where a.id(+)=b.userid and b.month='200301' and a.name is null;
      

  4.   

    同意wonder01(一可)的看法
    多出来的两条记录应该是在a表不相关联的数据,可能就是无效数据
      

  5.   

    同意 cyberflying
    a表中有无效数据。
      

  6.   

    可是我按照 cyberflying
    写的SQL执行的select A.name,b.* 
    from userdata a,basicsalary b 
    where a.id(+)=b.userid and b.salarymonth='200301'显示Token Unknow- line3,char9 (错误提示
    还有在字段后面加(+)是什么意思?
      

  7.   

    SQL> select * from a1;BBB
    ----------
    101
    102
    103
    104
    105SQL> select * from a2;BBB        CCC
    ---------- --------------------
    101
    102
    105SQL> select * from a1,a2 where a1.bbb(+)=a2.bbb;BBB        BBB        CCC
    ---------- ---------- --------------------
    101        101
    102        102
    105        105SQL> select * from a1,a2 where a1.bbb=a2.bbb(+);BBB        BBB        CCC
    ---------- ---------- --------------------
    101        101
    102        102
    103
    104
    105        105SQL>