按段分组

需求:

        按段分组,统计各组下总数

 

select

pricegroup,count(*)

from

      ( select

         case

         when money >= 0 and money <10 then '0-10'

         when money >= 10 and money <20 then '10-20'

         when money >=20 then '20以上'

         end as pricegroup

          from pricetable ) as T1

group by pricegroup

posted @ 2019-04-19 14:03  林远  阅读(116)  评论(0)    收藏  举报