select datepart(year,日期) as 年
,datepart(month,日期) as 月
,count(*) as 计
from A
group by datepart(year,日期),datepart(month,日期)
,datepart(month,日期) as 月
,count(*) as 计
from A
group by datepart(year,日期),datepart(month,日期)
group by 年,月
select datepart(year,日期) as 年,datepart(month,日期) as 月,count(*) as 计
from A表
group by 年,月
group by year(日期),month(日期)
order by 1,2