我有一个带有表格答案的小游戏的数据库:每个用户每天最多可以玩和回答 2 次,表格答案的结构如下:
UID | ANSWER | DATE
我想做一个查询,以获取每天至少玩一次的用户数量。我做了这样的事情,但这不起作用。
SELECT Day(date) as n,
Dayname(date) as m,
uid,
COUNT(uid) as c
FROM answers
WHERE Year(date) = '2012'
GROUP BY uid HAVING count( * ) <=2 //COUNT user who played at least 2 times per day
GROUP BY n //group by day
ORDER BY n
我想得到这样的结果:
Friday | 9-5-2012 | 1254
Saturday | 10-5-2012 | 1427
...
任何帮助表示赞赏...