ahmedrahil786

Number of cars Per week by zone

Jun 19th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. select
  2. weekofyear(czl.log_date + interval '8' hour) as week,
  3. count(distinct czl.car_id) number_of_cars,
  4. z.id as zid,
  5. z.name as name,
  6. z.city as city
  7. from car_zone_logs czl
  8. join cars ca on ca.id = czl.car_id
  9. join car_classes cc on cc.id = ca.car_class_id
  10. join zones z on z.id = czl.zone_id
  11. Where czl.log_date + interval '8' hour >= @start
  12. and czl.zone_id not in (2,3,101,383,378,712,818,786)
  13. group by week,z.id ;
Advertisement
Add Comment
Please, Sign In to add comment