Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to do a FULL OUTER JOIN in MySQL?

I need to do a Full Outer Join in MySQL. Is this conceivable? Is a Full Outer Join upheld by MySQL?
by

2 Answers

espadacoder11
You don't have FULL JOINS on MySQL, but you can sure emulate them.

For a code SAMPLE transcribed from this SO question you have:

with two tables t1, t2:

SELECT FROM t1
LEFT JOIN t2 ON t1.id = t2.id
UNION
SELECT
FROM t1
RIGHT JOIN t2 ON t1.id = t2.id
RoliMishra
You can also try this:
select 
t1.value, t2.value
from t1
left outer join t2
on t1.value = t2.value
union all
select
t1.value, t2.value
from t2
left outer join t1
on t1.value = t2.value
where
t1.value IS NULL

Login / Signup to Answer the Question.