热线电话:13121318867

登录
2022-06-29 阅读量: 559
计算客户单量分布情况?

2c0a90bbac6f9bcb6d029c8247a3868.jpg

select 单量区间 , count(distinct 客户id) as 客户数 
from (
  select 客户id,单量,case when 单量 <= 5 then ‘0-5’ when 单量 >= 6 and 单量 <= 10 then ‘6-10’when 单量 >= 11 and 单量 <= 20          then ‘11-20’else ‘20以上’ end as 单量区间  
     from (
     select 客户id,count(distinct 运单号) as 单量 
     from 快递揽收表 
     where 创建日期 >= ‘2020-05-01’ and 创建日期 <= ‘2020-05-31’
     group by 客户id) 
   as t1) 
as t2 
group by 单量区间;


12.4471
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子