日期:2014-05-17 浏览次数:20567 次
select sum(case 很好 when 1 then 1 else 0 end) as sum_很好,
sum(case 较好 when 1 then 1 else 0 end) as sum_较好,
sum(case 一般 when 1 then 1 else 0 end) as sum_一般,
sum(case 接车 when 1 then 1 else 0 end) as sum_接车,
sum(case 机电 when 1 then 1 else 0 end) as sum_机电,
sum(case 钣金 when 1 then 1 else 0 end) as sum_钣金,
sum(case 美容 when 1 then 1 else 0 end) as sum_美容,
sum(case 销售 when 1 then 1 else 0 end) as sum_销售 from table
delcare @datetimefrom datetime,@datetimeto datetime
select @datetimefrom ='2013-05-01', @datetimeto ='2013-05-30',
select sum(case 很好 when 1 then 1 else 0 end) as sum_很好,
sum(case 较好 when 1 then 1 else 0 end) as sum_较好,
sum(case 一般 when 1 then 1 else 0 end) as sum_一般,
sum(case 接车 when 1 then 1 else 0 end) as sum_接车,
sum(case 机电 when 1 then 1 else 0 end) as sum_机电,
sum(case 钣金 when 1 then 1 else 0 end) as sum_钣金,
sum(case 美容 when 1 then 1 else 0 end) as sum_美容,
sum(case 销售 when 1 then 1 else 0 end) as sum_销售 from table
where 回访日期> @datetimefrom and 回访日期< @datetimeto
delcare @datetimefrom datetime,@datetimeto datetime
select @datetimefrom ='2013-05-01', @datetimeto ='2013-05-30',
select (select count(很好) from table where 很好=1) as sum_很好,
(select count(较好) from table where 较好=1) as sum_较好
....