Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set @start := '2019-09-1';
- select distinct c.member_id as mid, min(r.id) as first_res_attempt, r.state as state, date(r.start_at + interval 8 hour) as Start_date,
- date(c.created_at + interval '8' hour) as date,
- c.kind as kind
- from charges c join members m on m.id = c.member_id
- left join reservations r on r.member_id = c.member_id
- where c.created_at + interval '8' hour >= @start
- and m.imaginary = 'normal'
- and c.kind = 'subscriptionFee'
- group by 1
Advertisement
Add Comment
Please, Sign In to add comment