I’m using mssql
How do I do a outer join on three tables, one of which is a junction table?
There can be nulls in the menu or product tables and I need these included in the result.
SELECT *
from [web].[dbo].[tblMenus]
left outer JOIN [web].[dbo].[tblProductsRelMenus]
on [tblMenus].Id = [tblProductsRelMenus].MenuId
left outer JOIN [web].[dbo].[tblProducts]
on [tblProductsRelMenus].ProductId = [tblProducts].ProductId
This doesn’t give menu nulls, and if I change the second left to a right, I loose the product nulls…
What is the correct way to do this?
Perhaps you are looking for a full outer join