I have 4 tables, and the 4 are foreign keys in one junction table.
The problem is that I need to retrieve the jnction values that are missing.
For example:
Table A Table B Table C Table D
-------- --------- --------- ----------
1 4 7 A
2 5 8 B
JUNCTION TABLE
-----------------
1 4 7 A
1 4 7 B
1 4 8 A
1 4 8 B
1 5 7 A
1 5 7 B
1 5 8 A
1 5 8 B
2 4 7 A
2 4 7 B
2 4 8 A
2 4 8 B
2 5 7 A
2 5 7 B
2 5 8 A
2 5 8 B
So if the column 1 5 8 B is missing, when I run the query it shows 1 5 8 B..
Any Ideas?
I would use a cross join on your source tables, then join the result of that to your junction table.
EDIT: Kudos to andy holaday for pointing out that MySQL does not have FULL OUTER JOIN.