1

我正在使用访问权限,并且正在尝试编写一个查询,该查询将删除一列的重复项。到目前为止,这是我的查询:

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可能会有所帮助,但我不知道如何......
你能帮我吗?

提前致谢。

4

1 回答 1

0

只需将这些内衬放在 ORDER BY 行之前

GROUP BY
    Drawings.DrawingID,
    Players.NumOfGuessedAPainting,
    Players.NumOfGuessedBPainting,
    Players.NumOfGuessedCPainting,
    Words.Word

已编辑。

于 2013-03-25T10:43:09.863 回答