I am attempting to eliminate unwanted duplicate query results. The gist is that the field [CUSIP] exists in all tables in question, however, the field [4DTYR] exists in all tabl
In the FROM phase we specify table or tables that need to be queried, and if table operators are specified, this phase processes those operators from left to right. Join (Left / Right) are table operators and each table operator operates on one or two input tables and returns an output table. The result of a table operator is used as the left input to the next table operator—if one exists—and as the input to the next logical query processing phase otherwise. In your query i find two issues:
I think a pseudo like below might help:
select IDX_FS.CUSIP , DATA_BS.[4DTYR]
FROM
IDX_FS
LEFT JOIN DATA_BS
ON IDX_FS.CUSIP = DATA_BS.CUSIP
LEFT JOIN DATA_Footnotes
ON IDX_FS.CUSIP = DATA_Footnotes.CUSIP AND DATA_BS.CUSIP = DATA_Footnotes.CUSIP AND DATA_BS.[4DTYR] = DATA_Footnotes.[4DTYR]
LEFT JOIN DATA_IS
ON IDX_FS.CUSIP = DATA_IS.CUSIP AND DATA_BS.CUSIP = DATA_IS.CUSIP AND DATA_BS.[4DTYR] = DATA_IS.[4DTYR]
LEFT JOIN DATA_SP
ON IDX_FS.CUSIP = DATA_SP.CUSIP AND DATA_BS.CUSIP = DATA_SP.CUSIP AND DATA_BS.[4DTYR] = DATA_SP.[4DTYR]
-- LEFT JOIN DATA_Footnotes.[4DTYR] no need.
Hope this helps!!!