试图弄清楚我在这个sqlite查询中做错了什么。
SELECT count(id),player,matchId
FROM Goals
GROUP BY matchId,player
WHERE Goals > 2;
编辑:弄清楚出了什么问题,抱歉让人感到困惑。
答案 0 :(得分:2)
Goals
是一张桌子。您无法将其与数字进行比较。怎么样:
SELECT count(id), player, matchId
FROM Goals
GROUP BY matchId, player
HAVING count(id) > 2;
另外:
HAVING
,而不是WHERE
。SELECT
和GROUP BY
中按相同顺序放置聚合列。只是整洁。答案 1 :(得分:1)
where
在group by
SELECT count(id),player,matchId
FROM Goals
WHERE Goals > 2
GROUP BY matchId,player