ahmedrahil786

Push Notifications for Member > 1 Booking - Last 90 Days ac

Jul 1st, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. select * from
  2.  
  3. (select
  4. distinct r.member_id,
  5. count(r.id) as resv,
  6. m.display_name,
  7. m.email
  8. from reservations r
  9. join members m
  10. on r.member_id = m.id
  11. where r.created_at + interval '8' hour >= curdate() - interval 90 day
  12. and r.state = 'completed'
  13. and r.way != 'oneway'
  14. and m.state = 'normal'
  15. and m.imaginary = 'normal'
  16. group by r.member_id) A
  17.  
  18. where A.resv > 1
Advertisement
Add Comment
Please, Sign In to add comment