17,140
社区成员




select a.id, a.name, b.a_id, b.u_code
from a, b
where a.id = b.id(+)
and (b.id is null or b.u_code = 'sam')
select * from test_a a inner join
(select * from test_b union
select id A_ID,U_code from (select * from test_a a1 where not exists(select 1 from test_b where a_id=a1.id))b1, test_b
)b on a.id=b.a_id
where b.u_code='sam'