我在网上搜了说用子查询
select count(1) from (
select fbrandid, month(fdate) from table as m
where 1 = 1
group by m.fbrandid, month(fdate)
) aa;但是代码好难懂,研究了一下里面的查询结果是一个表,但是这个表没有名字,不给他名字就报错,所以加了一个别名aa(随便起)
count(1)也不是很好理解就换成count(fbrandid)或count(*)
最佳答案