这个错误加剧了我。我知道这是小事,但不能纠正它。
SELECT
tblPlayerStatistics.Player_ID_Number,
SUM(tblPlayerStatistics.TwoPointerMade + tblPlayerStatistics.ThreePointerMade) AS points,
MatchID
FROM
tblPlayerStatistics
INNER JOIN tblGameResults ON tblPlayerStatistics.MatchID = tblGameResults.MatchID
GROUP BY
tblPlayerStatistics.Player_ID_Number,
tblPlayerStatistics.MatchID;
答案 0 :(得分:0)
根据我从您的问题中所理解的,您在from子句中指定的多个表中存在相同列的问题 在这种情况下,您必须在查询中指定具有表名的列 或者,将表作为别名指定您的列,并为该表指定别名 在当前查询中进行更正。
SELECT
tblPlayerStatistics.Player_ID_Number,
SUM(tblPlayerStatistics.TwoPointerMade + tblPlayerStatistics.ThreePointerMade) AS points,
tblPlayerStatistics.MatchID
FROM
tblPlayerStatistics
INNER JOIN tblGameResults ON tblPlayerStatistics.MatchID = tblGameResults.MatchID
GROUP BY
tblPlayerStatistics.Player_ID_Number,
tblPlayerStatistics.MatchID;
您的MatchID
含糊不清,请指定您使用此列的表的表名。
您可以为表指定别名,并使用该别名来访问该表的列。
使用别名:
SELECT
ps.Player_ID_Number,
SUM(ps.TwoPointerMade + ps.ThreePointerMade) AS points,
ps.MatchID
FROM
tblPlayerStatistics ps
INNER JOIN tblGameResults gr ON ps.MatchID = gr.MatchID
GROUP BY
ps.Player_ID_Number,
ps.MatchID;