with rank as(
SELECT group_id, SUM(pay_dollar) as pay_dollars, count(*) as count FROM
(select mod(player_id, 33) as group_id, pay_amount*exchange as pay_dollar FROM mafia1.offer_purchase
WHERE timestamp >='2019-10-21 12:10:00' and timestamp <='2019-10-22 18:50:00' and player_id not in (select player_id FROM mafia1.create_player where uid in (select uid from mafia1.internal_user)))
# and player_id in (select player_id FROM mafia1.create_player where timestamp >='2019-07-01'))
#where pay_dollar >=90
group by group_id
order by pay_dollars)
select group_id, pay_dollars/total_dollars as ratio, count, pay_dollars, pay_dollars/count as mean FROM rank, (select SUM(pay_dollars) as total_dollars FROM rank)
Order by pay_dollars
添加链接描述
Index(['10904', '10648', '10225', '8532', '7595', '8518', '8538', '10393',
'11347', '9108',
...
'11081', '8452', '7378', '10889', '11099',
'91ift0698775""""speedup_ops_25"":1', '10890', '10409', '9856',
'10506'],
with rank as(
SELECT group_id, SUM(pay_dollar) as pay_dollars, count(*) as count FROM
(select mod(player_id, 33) as group_id, pay_amount*exchange as pay_dollar FROM mafia1.offer_purchase
WHERE timestamp >='2019-10-23 13:15:00' and timestamp <='2019-10-23 23:50:00' and player_id not in (select player_id FROM mafia1.create_player where uid in (select uid from mafia1.internal_user)))
# and player_id in (select player_id FROM mafia1.create_player where timestamp >='2019-07-01'))
#where pay_dollar >=90
group by group_id
order by pay_dollars)
select group_id, pay_dollars/total_dollars as ratio, count, pay_dollars, pay_dollars/count as mean FROM rank, (select SUM(pay_dollars) as total_dollars FROM rank)
Order by pay_dollars
with rank as(
SELECT group_id, SUM(pay_dollar) as pay_dollars, count(*) as count FROM
(select mod(player_id, 33) as group_id, pay_amount*exchange as pay_dollar FROM mafia1.offer_purchase
WHERE timestamp >='2019-10-19 03:00:00' and timestamp <='2019-10-23 23:50:00' and player_id not in (select player_id FROM mafia1.create_player where uid in (select uid from mafia1.internal_user)))
# and player_id in (select player_id FROM mafia1.create_player where timestamp >='2019-07-01'))
#where pay_dollar >=90
group by group_id
order by pay_dollars)
select group_id, pay_dollars/total_dollars as ratio, count, pay_dollars, pay_dollars/count as mean FROM rank, (select SUM(pay_dollars) as total_dollars FROM rank)
Order by pay_dollars