I've got three tables A B and C (the last is the result I want)
A.id B.age C.id C.age result id age
1 5 1 5 1 5
2 6 2 0 null null
3 7 0 7 null null
4 8 4 8 4 8
5 9 5 9 5 9
I want to do an outer join from A and B to C such that I end up with result above. If either of the columns are missing from C, it should yield null. If I do an inner join:
select a.id, b.age where a.id = c.id and b.age = c.age
I'll get 3 rows back. I still want 5 rows back. I'm using IBM db2 v9 something. I'm trying to figure out using the newer left outer join syntax how to make it go, but I'm not seeing it. I can see how I'd do it in the old sybase *= outer join syntax, but I can't see how to do it the new style way. Is this even possible?
Somebody suggested doing a union of half the results of each. Unions just make a mess, seems to me, I should be able to do a left outer join from both tables.
Help? Thanks.