SELECT year(fCreatTime)as 年份,sum (case when fLeiBie='1' then 1 else 0 end) as 报修,
sum(case when fLeiBie='2' then 1 else 0 end) as 咨询,
sum(case when fLeiBie='3' then 1 else 0 end) as 投诉
FROM [DB_SZHPT_HQ].[dbo].[tb_FeedBack] group by year(fCreatTime)
GO
SELECT month(fCreatTime) as 月份 ,sum (case when fLeiBie='1' then 1 else 0 end) as 报修,
sum(case when fLeiBie='2' then 1 else 0 end) as 咨询,
sum(case when fLeiBie='3' then 1 else 0 end) as 投诉
FROM [DB_SZHPT_HQ].[dbo].[tb_FeedBack] group by month(fCreatTime)
GO