我有 2 个 MySQL 表(用户和评论) - 我想做的是获取一份报告,告诉我有多少用户发表了 1 条评论,有多少用户发表了 2 条评论,有多少用户发表了 3 条评论以及有多少用户发表了 4 条以上评论评论,按月和年分组。
我有这个查询来获取按年/月分组的每个用户发表的评论数
select year(c.datecreated) as comment_year, month(c.datecreated) as comment_month,
count(c.id) as num_comments
from tblcomments c
inner join tbluser u on u.id = c.userid
where
c.datecreated <= '2013-02-19' and c.datecreated >= '2012-03-01'
group by c.userid, year(c.datecreated), month(c.datecreated)
如何修改此查询以提供我想要的结果?