Not satisfied by the Answer? Still have doubts?
Ask Question

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?
join mysql sql
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.

  • Be descriptive with your answer, and try to avoid copy-pasting external links, instead guide the user who has asked the question, where can they find the detailed answer.
  • You cannot share any URL in answer.
  • To make a text bold, surround the text with single asterisk, for example *bold text*
  • To format a text like code, surround the text within double asterisk, for example **code**
  • To add a multiline piece of code, surround the whole code within triple asterisk, for example *** multiline code ***
  • Please verify before submitting the answer.