我正在使用访问权限,而我正在尝试编写一个查询,该查询将删除一列的重复项。这是我到目前为止的查询:
SELECT
Drawings.DrawingID,
Players.NumOfGuessedAPainting,
Players.NumOfGuessedBPainting,
Players.NumOfGuessedCPainting,
Words.Word
FROM Words INNER JOIN
(Players INNER JOIN
(Drawings INNER JOIN
PlayersAndWords
ON Drawings.DrawingID = PlayersAndWords.DrawingID)
ON Players.PlayerID = PlayersAndWords.DrawingPlayerID)
ON Words.WordID = PlayersAndWords.WordID
WHERE ((Words.Word)='" + w + "')
ORDER BY (Players.NumOfGuessedAPainting
+Players.NumOfGuessedBPainting * 2
+Players.NumOfGuessedCPainting *3 ) DESC
列Drawings.DrawingID
可能是重复的,我希望查询只返回每个Drawings.DrawingID的一行。 “不同”在这里不起作用。我读过group by
可能会有所帮助,但我无法弄清楚如何......
你可以帮帮我吗?
提前致谢。
答案 0 :(得分:0)
只需在ORDER BY行
之前加上这些内容GROUP BY
Drawings.DrawingID,
Players.NumOfGuessedAPainting,
Players.NumOfGuessedBPainting,
Players.NumOfGuessedCPainting,
Words.Word
编辑。