My apologies in advance if this particular question has already been asked and answered ... there so many different particular ways the JOIN command is used that it can be difficult to find the exact answer to a given problem. I'm a SQL novice, so ... if the solution exists, feel free to point me to it.
I'm trying to join 3 different tables, and I believe what I want is equivalent to a FULL OUTER JOIN (not supported by MySQL, as I understand) on all 3 tables. Consider a Venn diagram with 3 circles; I want the full union of all 3 circles, including the full intersection, all three pair-wise joins (where one table returns NULLs), and all three single instances (where two tables return NULLs). I believe what I've got here will work, but it's brute-force and I'm sure there is a more efficient way. I'm also a bit concerned with my use of WHERE NOT EXISTS, so please correct me if necessary. Here's the gist of my code:
// Intersection of all three tables
SELECT [table1.cols], [table2.cols], [table3.cols]
FROM table1
INNER JOIN table2
ON table1.col1 = table2.col1
INNER JOIN table3
ON table1.col1 = table3.col1
UNION ALL
// Intersection of tables one and two
SELECT [table1.cols], [table2.cols], [NULLS]
FROM table1
INNER JOIN table2
ON table1.col1 = table2.col1
WHERE NOT EXISTS (table1.col1 = table3.col1)
UNION ALL
// Intersection of tables two and three
SELECT [NULLS], [table2.cols], [table3.cols]
FROM table2
INNER JOIN table3
ON table2.col1 = table3.col1
WHERE NOT EXISTS (table2.col1 = table1.col1)
UNION ALL
// Intersection of tables three and one
SELECT [table1.cols], [NULLS], [table3.cols]
FROM table3
INNER JOIN table1
ON table3.col1 = table1.col1
WHERE NOT EXISTS (table3.col1 = table2.col1)
UNION ALL
// Only in table one
SELECT [table1.cols], [NULLS], [NULLS]
FROM table1
WHERE NOT EXISTS ((table1.col1 = table2.col1))
AND NOT EXISTS ((table1.col1 = table3.col1))
UNION ALL
// Only in table two
SELECT [NULLS], [table2.cols], [NULLS]
FROM table2
WHERE NOT EXISTS ((table2.col1 = table1.col1))
AND NOT EXISTS ((table2.col1 = table3.col1))
UNION ALL
// Only in table three
SELECT [NULLS], [NULLS], [table3.cols]
FROM table3
WHERE (NOT EXISTS (table3.col1 = table1.col1))
AND (NOT EXISTS (table3.col1 = table2.col1))
TIA for your help, and your grace. :)