SQL: JOIN syntax error

前端 未结 2 1399
囚心锁ツ
囚心锁ツ 2021-01-28 23:45

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

2条回答
  •  天涯浪人
    2021-01-29 00:25

    It appears that you have one ( too many:

    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
          ) 
          LEFT JOIN DATA_IS ON IDX_FS.CUSIP = DATA_IS.CUSIP
         ) 
         LEFT JOIN DATA_SP ON IDX_FS.CUSIP = DATA_SP.CUSIP AND 
         ( -- This is unmatched
          (
           (DATA_BS LEFT JOIN DATA_IS ON DATA_BS.CUSIP = DATA_IS.CUSIP AND DATA_BS.4DTYR = DATA_IS.4DTYR)     
           LEFT JOIN DATA_SP ON DATA_BS.CUSIP = DATA_SP.CUSIP AND DATA_BS.4DTYR = DATA_SP.4DTYR
          ) 
          LEFT JOIN DATA_Footnotes.4DTYR ON DATA_BS.CUSIP = DATA_Footnotes.CUSIP AND DATA_BS.4DTYR = DATA_Footnotes.4DTYR
         -- A ) here perhaps?
    

提交回复
热议问题