ahmedrahil786

Number of Cars and Car types by month - Sufian

Sep 24th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. select month(czl.log_date + interval 8 hour) as month,
  2. Year(czl.log_date + interval 8 hour) as year,
  3. cc.car_name as carname,
  4. count(distinct czl.car_id) as ncars
  5. from car_zone_logs czl left join cars c on czl.car_id = c.id
  6. left join car_classes cc on c.car_class_id = cc.id
  7. where year(czl.log_date + interval 8 hour) = '2019'
  8. group by 1,2,3
Advertisement
Add Comment
Please, Sign In to add comment