Convert TSQL to MS-Access SQL

前端 未结 2 1626
太阳男子
太阳男子 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:20

    This works in Access.

    SELECT *
    FROM (((Individual AS IND 
    
    INNER JOIN Ethnicity AS ETH 
        ON IND.EthnicityID = ETH.ID) 
    
    INNER JOIN Education AS EDU 
        ON IND.EducationID = EDU.ID) 
    
    INNER JOIN Marital AS MAR 
        ON IND.Marital = MAR.ID) 
    
    INNER JOIN (((((((Participant AS PAR 
    
        INNER JOIN Official AS OFR 
            ON PAR.ReferringPO = OFR.ID) 
    
        INNER JOIN [Class-Participant] AS CXP 
            ON PAR.ID = CXP.ParticipantID) 
    
        INNER JOIN Class AS CLS 
            ON CXP.ClassID = CLS.ID) 
    
        INNER JOIN [Participant-Official] AS PXO 
            ON PAR.ID = PXO.ParticipantID) 
    
        INNER JOIN Official AS OFA 
            ON PXO.OfficialID = OFA.ID) 
    
        INNER JOIN [Participant-Probation] AS PXP 
            ON PAR.ID = PXP.ParticipantID) 
    
        INNER JOIN Probation AS PBN 
            ON PXP.ProbationID = PBN.ID) 
    
     ON IND.APETSID = PAR.APETSID
    

    As you can see, the tables to be joined are grouped together.

提交回复
热议问题