Skip to content
Advertisement

How to perform LEFT JOIN with condition

I want to perform something like this

Advertisement

Answer

If I understand correctly, you want to conditionally join to a table. I would recommend two left joins as in:

Because it is the same table, you could also use or in the on clause:

However, or in an on clause usually kills performance.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement