ahmedrahil786

Number and Type of cars per each Zone - For Utilization Rate

Mar 18th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. select
  2.  
  3. c.id as carid,
  4. cc.id as carclassid,
  5. z.region as Region,
  6. date(cz.created_at + interval '8' hour) as day,
  7. cc.car_name as carname
  8.  
  9. from cars as c
  10.  
  11. join car_classes as cc
  12. on c.car_class_id = cc.id
  13.  
  14. join zones as z
  15. on z.id = c.zone_id
  16.  
  17. join car_zone_logs as cz
  18. on c.id = cz.car_id
  19.  
  20. where cz.car_state = 'Normal'
  21. and z.state = 'normal'
  22.  
  23. group by c.id
Advertisement
Add Comment
Please, Sign In to add comment