Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select month(czl.log_date + interval 8 hour) as month,
- Year(czl.log_date + interval 8 hour) as year,
- z.city as city,
- cc.car_name as carname,
- count(distinct czl.car_id) as ncars
- from car_zone_logs czl left join cars c on czl.car_id = c.id
- left join car_classes cc on c.car_class_id = cc.id
- left join zones z on c.zone_id = z.id
- where year(czl.log_date + interval 8 hour) = '2020'
- and month(czl.log_date + interval 8 hour) = '4'
- and date(czl.log_date + interval 8 hour) = date_sub(CURDATE(), interval 1 day)
- and z.city in ('KL','PG','JB','SL')
- and czl.zone_state = 'normal'
- and c.state = 'normal'
- group by 1,2,3,4
Advertisement
Add Comment
Please, Sign In to add comment