How can I make full participation in multi-row tables in MySQL?

we searched for it, but all we see are 2 tables on the left and right internal / external joins.

I love you guys.

+6
source share
2 answers

MySQL does not support FULL OUTER JOIN.

As you mentioned, you can simulate a FULL OUTER JOIN from two tables using a combination of LEFT and RIGHT OUTER.

SELECT * FROM tableA LEFT JOIN tableB ON tableA.b_id = tableB.id UNION ALL SELECT * FROM tableA RIGHT JOIN tableB ON tableA.b_id = tableB.id WHERE tableA.b_id IS NULL 

The same method can theoretically be extended to more than two tables. First, I would suggest using the above approach to join the two tables as view . Then use the same approach again to join the view in the third table.

+3
source

I do not know what to say about part of love, but

The presence of tables with the names a and b:

 SELECT a.*, b.* FROM a, b 

Is this a trick?

0
source

Source: https://habr.com/ru/post/888804/


All Articles