Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set @startDate = "2017-01-01 00:00:00";
- select Distinct A.mid as mid, Count(A.rid) as resv from
- (select
- distinct c.reservation_id as rid,
- m.id as mid
- from charges c
- left join members m on m.id = c.member_id
- left join reservations r on r.id = c.reservation_id
- where c.kind = 'accident'
- and date(c.created_at + interval '8' hour) >= @startdate
- group by 1) A
- group by 1
Advertisement
Add Comment
Please, Sign In to add comment