Convert TSQL to MS-Access SQL

前端 未结 2 1607
太阳男子
太阳男子 2021-01-05 06:58

TSQL (as used in MS SQL Server 2000 and 2005) allows multiple JOIN clauses, one right after the other, no commas or parentheses needed. Try this in Access and it throws a fi

2条回答
  •  伪装坚强ぢ
    2021-01-05 07:18

    Yah, MS-Access is dumb.

    I don't think one exists (probably not a huge market either to go from MS-SQL/TSQL to MS-Access). Typically, I use the Design View which is not really a wizard as far as I'm concerned. I then manually add the tables, and then (if I haven't created a proper Relations ship diagram, or something is a little funky) manually create the relationships in the Designer. After that, I check the query in the SQL view and correct as need be.

    In the case of your example (as you indicated) you probably need the parenthesis, and will have to manually add them. You probably want something like this:

    SELECT ...
    FROM (((Participant PAR
        INNER JOIN Individual IND 
            ON PAR.APETSID = IND.APETSID)
        INNER JOIN Ethnicity ETH 
            ON IND.EthnicityID = ETH.ID)
        INNER JOIN Education EDU 
            ON IND.EducationID = EDU.ID)
        INNER JOIN Marital MAR 
            ON IND.Marital = MAR.ID
    

    (if you have N inner joins, you will need N-1 open-parenthesis at the beginning, and one on ever end of the join; excluding the last one)

提交回复
热议问题