表结构如下
select count(case when ifnull(turnover,0) <500 then id end) as model1
,count(case when ifnull(turnover,0)>=500 and ifnull(turnover,0)<1000 then id end) as model2
,count(case when ifnull(turnover,0)>=1000 and ifnull(turnover,0)<1500 then id end) as model3
,count(case when ifnull(turnover,0)>=1500 and ifnull(turnover,0)<2000 then id end) as model4
,count(case when ifnull(turnover,0)>=2000 and ifnull(turnover,0)<3000 then id end) as model5
,count(case when ifnull(turnover,0)>=3000 and ifnull(turnover,0)<5000 then id end) as model6
,count(case when ifnull(turnover,0)>=5000 and ifnull(turnover,0)<8000 then id end) as model7
,count(case when ifnull(turnover,0)>=8000 and ifnull(turnover,0)<10000 then id end) as model7
,count(case when ifnull(turnover,0)>=10000 then id end) as model8
from vet_rundata
结果集