LEFT JOIN SQL Join Expression not supported

前端 未结 1 392
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-18 12:51

I can\'t find what is wrong with this SQL expression:

SELECT DISTINCT PNLTERM.TAGSTRIP, TERMS.TERM, PNLTERM.STRIPSEQ, TERMS.WIRENO, 
TERMS.REF, TERMS.MFG, TE         


        
1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-18 13:19

    MS Access has some rules regarding its use of LEFT/RIGHT joins with the INNER joins. Specifically, there is a rule regarding its mix. It is explained here:

    A LEFT JOIN or a RIGHT JOIN may be nested inside an INNER JOIN, but an INNER JOIN may not be nested inside a LEFT JOIN or a RIGHT JOIN.

    You have a couple of options: You can convert the second join to a left join:

    SELECT DISTINCT PNLTERM.TAGSTRIP, TERMS.TERM, PNLTERM.STRIPSEQ, TERMS.WIRENO, 
    TERMS.REF, TERMS.MFG, TERMS.CAT, TERMS.BLOCK, PNLTERM.HDL, TERMS.WDBLKNAM, 
    TERMS.JUMPER_ID, WIREFRM2.WIRELAY
    FROM (PNLTERM LEFT JOIN TERMS ON PNLTERM.LINKTERM = TERMS.LINKTERM) 
    LEFT JOIN WIREFRM2 ON TERMS.HDL = WIREFRM2.COMP_HDL;
    

    Or, you can change the query, so that the INNER join comes first:

    SELECT DISTINCT PNLTERM.TAGSTRIP, TERMS.TERM, PNLTERM.STRIPSEQ, TERMS.WIRENO, 
    TERMS.REF, TERMS.MFG, TERMS.CAT, TERMS.BLOCK, PNLTERM.HDL, TERMS.WDBLKNAM, 
    TERMS.JUMPER_ID, WIREFRM2.WIRELAY
    FROM (WIREFRM2 INNER JOIN TERMS ON TERMS.HDL = WIREFRM2.COMP_HDL) 
    RIGHT JOIN PNLTERM ON PNLTERM.LINKTERM = TERMS.LINKTERM;
    

    0 讨论(0)
提交回复
热议问题