我有以下保存的查询“qGetClubPoints”
padding-right: 20px
上述查询根据每个类别组每个事件的前4个结果生成每个俱乐部的积分。当我运行上面的查询时,我得到了预期的结果。 现在我想从上面的结果中执行一个数据透视表
SELECT t1.[season], t1.evIndex, t1.Category, t1.runner,
t1.runnerName, t1.ClubID, t1.ClubPoints, t2.CategoryGroupID
FROM
League AS t1 INNER JOIN
[Categories] AS t2
ON t1.category = t2.category
WHERE
t1.[season]>=2017
AND
t1.[runner] IN
(
SELECT TOP 4 runner FROM [league] as t11
INNER JOIN [Categories] as t12
ON t11.category = t12.category
WHERE t11.evIndex=t1.evIndex
AND t11.clubID=t1.ClubID
AND t12.CategoryGroupID=t2.CategoryGroupID
ORDER BY ClubPoints DESC, runner DESC
)
ORDER BY t1.evIndex, t1.ClubID, t2.CategoryGroupID, t1.ClubPoints DESC
但是,我收到错误:
Microsoft Access数据库引擎无法将“t1.evIndex”识别为有效的字段名称或表达式
当查询用作数据透视表的源时,查看查询中的内部参数(例如TRANSFORM sum(ClubPoints) SELECT ClubID FROM qGetClubPoints GROUP BY ClubID PIVOT evIndex
)。
答案 0 :(得分:0)
尝试将“qGetClubPoints”记录集写入表中;然后将您的数据透视查询应用于此表。
丑陋但可能有效