1. Example
Calculate the following distance under the same timestamp
4 car following distance = 94.84-72.48
2.demo
update cacc_log e,(select timestamp,x from
(
select timestamp,sum(x) as x from
(
select timestamp,x from cacc_log where carid ='5' and rwmc ='CACC01'
union all
select timestamp,x*(-1) from cacc_log where carid ='4' and rwmc ='CACC01'
)
as c group by timestamp
) as d ) f
set e.flowdist = f.x
where e.timestamp = f.timestamp and carid ='4' and rwmc ='CACC01';