微软访问错误
Microsoft Access Error
错误:在查询表达式中无效使用 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 语句是错误的?
不确定如何在此处编辑查询结构。
用双引号替换 "smart quotes"(来自 Word 的复制粘贴?):
,Val(DMax("Id", "Jacksonville", "Id <= " & Q.[Id] & "
AND Unit IS NOT Null")) AS ParentId
错误:在查询表达式中无效使用 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 语句是错误的? 不确定如何在此处编辑查询结构。
用双引号替换 "smart quotes"(来自 Word 的复制粘贴?):
,Val(DMax("Id", "Jacksonville", "Id <= " & Q.[Id] & "
AND Unit IS NOT Null")) AS ParentId