Microsoft Access错误

时间:2017-06-23 15:33:26

标签: ms-access ms-access-2016

错误:在查询表达式中无效使用IS运算符...

这是格式化的SQL代码by poorsql.com

TRANSFORM Sum(Jacksonville.[Lease Rent]) AS SumOfAmount

SELECT S.Unit
    ,S.[Floorplan]
    ,S.[Unit Designation]
    ,S.SQFT
    ,S.[Unit and Lease Status]
    ,S.NAME
    ,S.[Move-In and Move-Out]
    ,S.[Lease Start]
    ,S.[Lease End]
    ,S.[Market and Addl.]
    ,S.[Sub Journal]
    ,S.[Trans Code]
    ,S.[Lease Rent]
    ,S.[Charges and Credits]
FROM Jacksonville
    ,(
        SELECT Q.Id
            ,Val(DMax(“Id”, ”Jacksonville”, ”Id <= “ & Q.[Id] & “
                    AND Unit IS NOT Null”)) AS ParentId
        FROM Jacksonville AS Q
        ) AS T
    ,(
        SELECT Jacksonville.Id
            ,Jacksonville.Unit
            ,Jacksonville.[Floorplan]
            ,Jacksonville.[Unit Designation]
            ,Jacksonville.SQFT
            ,Jacksonville.[Unit and Lease Status]
            ,Jacksonville.NAME
            ,Jacksonville.[MoveIn and MoveOut]
            ,Jacksonville.[Lease Start]
            ,Jacksonville.[Lease End]
            ,Jacksonville.[Market and Addl]
            ,Jacksonville.[Sub Journal]
            ,Jacksonville.[Trans Code]
            ,Jacksonville.[Lease Rent]
            ,Jacksonville.[Charges and Credits]
        FROM Jacksonville
        WHERE Jacksonville.Unit IS NOT NULL
        ) AS S
WHERE Jacksonville.Id = [T].[Id]
    AND T.ParentId = [S].[Id]
GROUP BY T.ParentId
    ,S.Unit
    ,S.[Floorplan]
    ,S.[Unit Designation]
    ,S.SQFT
    ,S.[Unit and Lease Status]
    ,S.NAME
    ,S.[Move-In and Move-Out]
    ,S.[Lease Start]
    ,S.[Lease End]
    ,S.[Market and Addl.]
    ,S.[Sub Journal]
    ,S.[Trans Code]
    ,S.[Lease Rent]
    ,S.[Charges and Credits]
PIVOT Jacksonville.[Trans Code] IN (
        [“ADMIN HOUS”]
        ,”EXRENT”
        ,[”LHA RENT”]
        ,[”MK-PREMIUM LHA”]
        ,”RENT”
        ,”SUBRENT”
        ,”SUBSIDY”
        ,”UTAC”
        ,”UTILREIMB”
        ,”OFF / SOCIAL”
        );

这个语法适用于我的另一个,但由于某种原因不在这里。为什么我的IS声明错了? 不知道如何在这里编辑查询结构。

1 个答案:

答案 0 :(得分:0)

替换&#34;智能引号&#34; (来自Word的复制粘贴?)带双引号:

,Val(DMax("Id", "Jacksonville", "Id <= " & Q.[Id] & "
                AND Unit IS NOT Null")) AS ParentId