Advertisement
DimitarVasilev

Untitled

Jun 29th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.54 KB | None | 0 0
  1. SELECT v.numberplate, MIN(vd.gps_full_date)
  2. FROM vehicle v,
  3. vo_vehicle_category vc,
  4. vehicle_owner vo,
  5. vehicle_data vd,
  6. oc_poi op,
  7. vd_poi vp,
  8. person p
  9. WHERE vp.vehicle_data_id=vd.vehicle_data_id
  10. AND vd.person_id=v.person_id
  11. AND v.vehicle_id=vd.vehicle_id
  12. AND v.vo_vehicle_category_id=vc.vo_vehicle_category_id
  13. AND vc.vehicle_owner_id=vo.vehicle_owner_id
  14. AND vp.poi_id<>p.home_poi_id
  15. AND p.person_id=v.person_id(+)
  16. AND vd.gps_full_date = to_date('15-FEB-14')
  17. AND vo.vehicle_owner_id = 100573
  18. GROUP BY trunc(vd.gps_full_date), v.numberplate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement