Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select * from
- (select
- distinct r.member_id,
- count(r.id) as resv,
- m.display_name,
- m.email
- from reservations r
- join members m
- on r.member_id = m.id
- where r.created_at + interval '8' hour >= curdate() - interval 90 day
- and r.state = 'completed'
- and r.way != 'oneway'
- and m.state = 'normal'
- and m.imaginary = 'normal'
- group by r.member_id) A
- where A.resv > 1
Advertisement
Add Comment
Please, Sign In to add comment