ahmedrahil786

Number of car per each car type in a month

Sep 19th, 2019
176
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. cc.car_name as carname,
  3. count(distinct czl.car_id) as ncars
  4. from car_zone_logs czl left join cars c on czl.car_id = c.id
  5. left join car_classes cc on c.car_class_id = cc.id
  6. where month(czl.log_date + interval 8 hour) = '7'
  7. and year(czl.log_date + interval 8 hour) = '2019'
  8. group by 1,2
Advertisement
Add Comment
Please, Sign In to add comment