As a schematic example, I have 3 tables that I want to join, A, B, C, where AB is connected via an external join, and BC is potentially connected through an internal join. In this constellation, I have to write two outer joins to get the data if the first connection does not have an AB match in the string:
SELECT [fields] FROM A LEFT OUTER JOIN B ON [a.field]=[b.field] LEFT OUTER JOIN C ON [b.field]=[c.field]
It seems logical to me that I should write the second statement as an external join. However, I am curious if it is possible to set the brackets for the join area in order to signal that the second join should only be used if the first inner join has detected the corresponding data for AB. Sort of:
SELECT [fields] FROM A (LEFT OUTER JOIN B ON [a.field]=[b.field] INNER JOIN C ON [b.field]=[c.field] )
I played a little, but did not find the ability to set the brackets. The only way I found work was through a subquery. Is this the only way to go?
source share