1.示例
计算 相同时间戳下 跟车距离
4车的跟车距离 = 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';