日期:2014-05-17 浏览次数:20699 次
select Name, sum(case when id<5 then 1 else 0 end) as count1, sum(case when id>=5 and id<6 then 1 else 0 end) as count2, sum(case when id>6 then 1 else 0 end) as count3 from tb group by name