Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- year(r.return_at + interval '8' hour) as year,
- month(r.return_at + interval '8' hour) as month,
- ifnull(cc.car_name,"") as car_name,
- count(r.id) as resv
- from reservations r
- left join members m on m.id = r.member_id
- left join driver_licenses dl on dl.member_id = m.id
- left join cars cr on cr.id = r.car_id
- left join car_classes cc on cc.id = cr.car_class_id
- where m.imaginary in ('sofam', 'normal')
- and r.member_id not in ('125', '127')
- and r.start_zone_id not in (2, 3, 101)
- and r.state in ('completed')
- and year(r.return_at + interval '8' hour) is not null
- and dl.gender not in ('unknown')
- group by 1,2,3
- order by 1 desc
Advertisement
Add Comment
Please, Sign In to add comment