Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UPDATE
- (SELECT v.last_vehicle_data_id AS OLD,
- d.vehicle_data_id AS NEW
- FROM vehicle v,
- (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
- GROUP BY v.vehicle_id
- ) d
- WHERE d.vehicle_id = vd.vehicle_id
- AND d.dt = vd.gps_full_date
- ) d
- WHERE d.vehicle_id = v.vehicle_id
- ) t
- SET t.OLD = t.NEW;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement