I have a mysql query, that does the following,
SELECT * FROM categoryTable
LEFT JOIN userMenuTable
ON userMenuTable.categoryId = categoryTable.categoryId
this returns only results that match this condition
ON userMenuTable.categoryId = categoryTable.categoryId
I was hoping it would be possible to pull all the results and also the ones from the JOIN?
The result of a left outer join, as in your example, will contain all records of the "left"
categoryTable, even if the join-condition does not find any matching record in the "right"userMenuTable.On the other hand, a right outer join resembles a left outer join, except with the treatment of the tables reversed. Every row from the "right"
userMenuTablewill appear in the result-set at least once.As a1ex07 suggested in another answer, it may look like you need a full outer join, which in MySQL can be emulated with a
UNIONbetween aLEFT JOINand aRIGHT JOIN.