ahmedrahil786

MFTs first Booking state - For Failed Bookings - Rahil

Nov 29th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. set @start := '2019-09-1';
  2. 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,
  3. date(c.created_at + interval '8' hour) as date,
  4. c.kind as kind
  5. from charges c join members m on m.id = c.member_id
  6. left join reservations r on r.member_id = c.member_id
  7. where c.created_at + interval '8' hour >= @start
  8. and m.imaginary = 'normal'
  9. and c.kind = 'subscriptionFee'
  10. group by 1
Advertisement
Add Comment
Please, Sign In to add comment