select
name,
count(*) as total,
sum(case when month(opendate)=1 then 1 else 0 end) as jun,
sum(case when month(opendate)=2 then 1 else 0 end) as feb,
...
...
from projectlist
group by name
name,
count(*) as total,
sum(case when month(opendate)=1 then 1 else 0 end) as jun,
sum(case when month(opendate)=2 then 1 else 0 end) as feb,
...
...
from projectlist
group by name
jun=sum(case when month(opendate)=1 then 1 else 0 end)
Feb=sum(case when month(opendate)=2 then 1 else 0 end)
mar=sum(case when month(opendate)=3 then 1 else 0 end)
apr=sum(case when month(opendate)=4 then 1 else 0 end)
may=sum(case when month(opendate)=5 then 1 else 0 end)
junt=sum(case when month(opendate)=6 then 1 else 0 end)
jul=sum(case when month(opendate)=7 then 1 else 0 end)
aug=sum(case when month(opendate)=8 then 1 else 0 end)
sep=sum(case when month(opendate)=9 then 1 else 0 end)
oct=sum(case when month(opendate)=10 then 1 else 0 end)
nov=sum(case when month(opendate)=11 then 1 else 0 end)
dec=sum(case when month(opendate)=12 then 1 else 0 end)
from projectlist group by name
sum(case when month(convert(datetime,Opendate,120))=2 then Feb end) as Feb
....--从3月到12月的省略
from projectlist order by name
select name,sum(name) as tatol ,sum(case when month(convert(datetime,Opendate,120))=1 then 1 else 0 end) as Jun
sum(case when month(convert(datetime,Opendate,120))=2 then 1 else 0 end) as Feb
....--从3月到12月的省略
from projectlist order by name