Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --vehicle check
- (SELECT vd.vehicle_data_id,
- vd.vehicle_id,
- vd.gps_full_date
- FROM vehicle_data vd,
- (SELECT v.vehicle_id,
- MAX(vd.gps_full_date) AS dt
- FROM vehicle_data vd,
- vehicle v
- WHERE vd.vehicle_id = v.vehicle_id
- AND NVL(v.vehicle_status_id,0) = 0
- GROUP BY v.vehicle_id
- ) d
- WHERE d.vehicle_id = vd.vehicle_id
- AND d.dt = vd.gps_full_date);
- --person check
- (SELECT pd.person_data_id,
- pd.person_id,
- pd.event_date
- FROM person_data pd,
- (SELECT p.person_id,
- MAX(pd.event_date) AS dt
- FROM person_data pd,
- person p
- WHERE pd.person_id = p.person_id
- AND NVL(p.person_status_id,0) = 0
- GROUP BY p.person_id
- ) d
- WHERE d.person_id = pd.person_id
- AND d.dt = pd.event_date);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement