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

解决方案 »

  1.   

    select year(日期)  as 年,moth(日期)  as 月,count(*) as 计  from  A 
    group  by  年,月
      

  2.   

    用分组统计就可以了,
    select datepart(year,日期) as 年,datepart(month,日期) as 月,count(*) as 计
    from A表
    group by 年,月
      

  3.   

    select year(日期),month(日期),count(*) from 表
    group by year(日期),month(日期)
    order by 1,2