mysql 进行分组显示数据

select count(1) from (select osid,quduan,sum(peopleCount) as peopleCount,sum(price) as prices from (
select osid,
case WHEN Price<=10 then '10'
 WHEN Price>10 and Price<=50 then '50'  
 WHEN Price>50 and Price<=100 then  '100'  
 WHEN Price>100 and Price<=150 then '150'  
 WHEN Price>150 and Price<=500 then '500'   
 WHEN Price>500 and Price<=1000 then '1000'  
 WHEN Price>1000 and Price<=2000 then '2000'  
 WHEN Price>2000 then '>2000' end 'quduan',
SUM(1) as peopleCount,
SUM(Price) as price
from gameingotorder where DayTime>='20170613' and DayTime<='20170623'  group by quduan,osid )t  GROUP BY quduan ,osid




posted @ 2018-03-28 14:58  change_4_now  阅读(1343)  评论(0)    收藏  举报