日期:2014-05-17 浏览次数:20781 次
select ta.a,ta.b,ta.c,ta.d,tb.r from ( select 'aa' a,'aa' b,'aa' c,'aa' d from dual union all select 'bb','bb','bb','bb' from dual union all select 'cc','cc','cc','cc' from dual union all select 'dd','dd','dd','dd' from dual ) ta left join ( select * from ( select 'aa' a,'aa' b,'a' r from dual union all select 'bb','bb','b' from dual union all select 'cc','cc','c' from dual union all select 'dd','dd','d' from dual ) ) tb on ta.a=tb.a and ta.b=tb.b ------------------------------------- A B C D R 1 aa aa aa aa a 2 bb bb bb bb b 3 cc cc cc cc c 4 dd dd dd dd d