Advertisement
ahmedrahil786

Members , signups and Coupons

May 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. select
  2. A.date,
  3. A.mid,
  4. B.referral,
  5. C.couponname
  6. from
  7.  
  8. (select
  9. distinct m.id as mid,
  10. date(m.created_at + interval '8' hour) as date
  11. from members m
  12. where m.created_at+interval 8 hour >= '2019-05-01 00:00:00') A
  13.  
  14. left join
  15. (select
  16. distinct ma.member_id as mid,
  17. ma.recommender as referral
  18. from member_appendixes ma) B
  19. on B.mid = A.mid
  20.  
  21. left join
  22. (select
  23. distinct c.member_id as mid,
  24. c.comment as couponname
  25. from coupons c) C
  26. on C.mid = B.mid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement