最好写成
select a.aaa,b.aaa from table1 a,table2 where a.aaa=b.aaa;

解决方案 »

  1.   

    select a.aaa,b.aaa
    from table1 a,
    (select aaa from table2) b
    where a.aaa = b.aaa;
      

  2.   

    select aaa from table1 
      intersect
    select aaa from table2
      

  3.   

    to: ORARichard(没钱的日子......) 好象必须要这样写,原语句是这样的:select a.aaa, b.aaa
    from table1 a, table2 b
    where a.aaa = b.aaa(+)
    and b.month = '200412';我用外连接想把table1的记录都取出来,但是由于b.month = '200412',只取出部分,
    所以我想用子查询看行不行
      

  4.   

    to: NinGoo(宁哥) ( )
    用的方法报错:sql command not properly ended
      

  5.   

    楼主用的是805吧我用外连接想把table1的记录都取出来,但是由于b.month = '200412',只取出部分,
    所以我想用子查询看行不行----不理解什么意思select a.aaa, b.aaa
    from table1 a, table2 b
    where a.aaa = b.aaa(+)-----这就是外连接了啊而且是取table1的所有记录
      

  6.   

    to:  ORARichard(没钱的日子......) 
    817啊,但是如果加了b.month = '200412'的话就不是取所有的了,我试了,要不我再试试看。
      

  7.   

    我试了,如果加上b.month = '200412'的话就给过滤了,不是取table1所有的,所以我想用子查询,
    比如(语法可能不对):
    select aaa, (select aaa from table2 where month = '200412' )
    from table1
    where table1.aaa = table2.aaa(+);这样就不用受month = '200412'的控制了。
      

  8.   

    select a.aaa,b.aaa from table1 a,(select * from table2 where month='200412') b where a.aaa=b.aaa(+);