金额|账号数量
---|---
2000~4999|
5000~9999|
就是从订单的流水数据中统计每个充值区间段的用户 id 数量有多少,假定数据库表结构是这样的:
money
uid
---|---
2000~4999|
5000~9999|
就是从订单的流水数据中统计每个充值区间段的用户 id 数量有多少,假定数据库表结构是这样的:
money
uid
|
F281M6Dh8DXpD1g2Sep 29, 2018
1
充值金额改成区间不就行了
case when money > 2000 and money <= 4999 then 'a' when your-condition-here then 'b' else end 这样 然后 group by count(*) 就行了 |
|
yemoluoSep 29, 2018
3
每个段的大小不一样?
|
|
F281M6Dh8DXpD1g2Sep 29, 2018
4
@hisune 大概意思就这样的,你自己改改就行了,其实不就是把连续量改成离散量呗
|
|
5
@liprais
``` select elt(interval(a, 0, 100, 500), 'less100', '0to100', '100to500' 'more500') l, count(uid) from (select sum(money) as a,uid from orders group by uid) t group by l ``` 就是实现这种效果,我只能想到用这种方式 |