UPDATE smokevehicle ta
-- 利用LEFT JOIN的方式进行关联修改
LEFT JOIN(
-- 先通过查询的方式给每一条数据生成对应的10-500之间随机数
SELECT
smokevehicleid ,
CAST(rand() * 1 + rand() * 10 AS SIGNED) vc
FROM
smokevehicle
) ta2 ON ta.smokevehicleid = ta2.smokevehicleid
SET ta.CaptureDateTime = date_add(ta.CaptureDateTime, interval (ta2.vc ) minute)
where ta.smokevehicleid in (1,2);