full-outer-join

How to do a FULL OUTER JOIN in MySQL?

余生颓废 提交于 2019-11-25 21:35:34
问题 I want to do a Full Outer Join in MySQL. Is this possible? Is a Full Outer Join supported by MySQL? 回答1: 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 The query above works for special cases where a FULL OUTER JOIN operation would not produce any duplicate rows. The query above depends on