ahmedrahil786

One way - MFT MAU by Day - For jason

Jul 3rd, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. select
  2. Date(r.created_at + interval '8' hour) as Date,
  3. count(distinct r.member_id) as MAU,
  4. count(distinct D.mid) as MFT,
  5. count(distinct r.id) as Booking
  6. from reservations r
  7. left outer join (select
  8. c.reservation_id as rid,
  9. c.member_id as mid,
  10. c.kind as kind
  11. from charges c
  12. where c.created_at + interval '8' hour >= '2019-6-1'
  13. and c.kind = 'subscriptionFee'
  14. ) D on D.mid = r.member_id
  15. where r.created_at + interval '8' hour >= '2019-6-1'
  16. and r.way = 'oneway'
  17.  
  18. group by 1;
  19.  
  20. select
  21. Date(r.created_at + interval '8' hour) as date,
  22. count(distinct r.member_id) as MAU,
  23. count(distinct D.mid) as MFT,
  24. count(distinct r.id) as Booking
  25. from reservations r
  26. left outer join (select
  27. c.reservation_id as rid,
  28. c.member_id as mid,
  29. c.kind as kind
  30. from charges c
  31. where c.created_at + interval '8' hour >= '2019-1-1'
  32. and c.kind = 'subscriptionFee'
  33. ) D on D.mid = r.member_id
  34. where r.created_at + interval '8' hour >= '2019-1-1'
  35. and r.way = 'oneway'
  36.  
  37. group by 1;
Advertisement
Add Comment
Please, Sign In to add comment