Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set @start := '2018-12-31 00:00';
- select
- Date(date_sub(czl.log_date , interval 1 day)) as week,
- weekday(date_sub(czl.log_date , interval 1 day)) as weekday,
- count(distinct czl.car_id ) as ncars
- from car_zone_logs czl
- where czl.log_date + interval '8' hour >= @start
- and czl.car_state = 'normal'
- and czl.zone_state = 'normal'
- and czl.csa_state = 'normal'
- and weekday(date_sub(czl.log_date , interval 1 day)) = 6
- group by 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement