View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 10:11 AM
Whit Nelson
 
Posts: n/a
Default Full Outer Join, Merge Result

Hello Internet!
Since MySQL doesn't have a native FULL OUTER JOIN, I simulated it,
using a LEFT OUTER JOIN, and RIGHT OUTER JOIN, UNIONing the result
together. The result is like this:

id A id B
53 8 53 15
9 7 9 20
55 7 55 16
54 2 NULL NULL
50 2 50 10
47 2 47 11
57 1 NULL NULL
58 1 58 4
NULL NULL 45 4
NULL NULL 41 3

Where some ids have values for both A and B, but some only have one,
with NULL in the other. (Also, NULL in the id field)

I am trying to merge the id fields into one, so I can reference their
respective values.

Can anyone help me with this? Thanks in advance,

-- whit nelson

Reply With Quote