I\'m running into an issue with which I can\'t figure out how to correctly configure a join. I\'m using reporting software that utilizes the (+) indicators in the WHERE clause f
Join option 1 is the equivalent of:
SELECT *
FROM TXN
LEFT OUTER JOIN CHK
ON ( TXN.CHK_ID = CHK.CHK_ID )
WHERE TXN.CURRENT = 'Y'
AND CHK.CURRENT = 'Y'
However, since any rows that are in the result set will have CHK.CURRENT = 'Y'
(a non-null value) then those rows must have matched on CHK_ID
and the query is actually the equivalent of:
SELECT *
FROM TXN
INNER JOIN CHK
ON ( TXN.CHK_ID = CHK.CHK_ID )
WHERE TXN.CURRENT = 'Y'
AND CHK.CURRENT = 'Y'
Join option 2 is the equivalent of:
SELECT *
FROM TXN
LEFT OUTER JOIN CHK
ON ( TXN.CHK_ID = CHK.CHK_ID
AND CHK.CURRENT = 'Y' )
WHERE TXN.CURRENT = 'Y'
You can make Join option 1 the equivalent of option 2 using:
SELECT *
FROM TXN
LEFT OUTER JOIN CHK
ON ( TXN.CHK_ID = CHK.CHK_ID )
WHERE TXN.CURRENT = 'Y'
AND ( CHK.CURRENT = 'Y' OR CHK.CHK_ID IS NULL )