Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- Date(r.created_at + interval '8' hour) as Date,
- count(distinct r.member_id) as MAU,
- count(distinct D.mid) as MFT,
- count(distinct r.id) as Booking
- from reservations r
- left outer join (select
- c.reservation_id as rid,
- c.member_id as mid,
- c.kind as kind
- from charges c
- where c.created_at + interval '8' hour >= '2019-6-1'
- and c.kind = 'subscriptionFee'
- ) D on D.mid = r.member_id
- where r.created_at + interval '8' hour >= '2019-6-1'
- and r.way = 'oneway'
- group by 1;
- select
- Date(r.created_at + interval '8' hour) as date,
- count(distinct r.member_id) as MAU,
- count(distinct D.mid) as MFT,
- count(distinct r.id) as Booking
- from reservations r
- left outer join (select
- c.reservation_id as rid,
- c.member_id as mid,
- c.kind as kind
- from charges c
- where c.created_at + interval '8' hour >= '2019-1-1'
- and c.kind = 'subscriptionFee'
- ) D on D.mid = r.member_id
- where r.created_at + interval '8' hour >= '2019-1-1'
- and r.way = 'oneway'
- group by 1;
Advertisement
Add Comment
Please, Sign In to add comment