由于某种原因,我在MySql中收到错误:您无法在FROM子句中指定目标表的“位置”进行更新
UPDATE location
SET
lat = 37.05,
lng = - 122.05,
power = 90,
speed = 90,
utc = '155',
gmt = '156'
WHERE
location.index IN (SELECT
MAX(location.index)
FROM
location
WHERE
location.truckid = '1480c667-0bc9-3c60-85f3-6de3b6cd5ad4');
我做错了什么?
答案 0 :(得分:1)
尝试在子查询周围放置另一个SELECT
。
UPDATE location
SET lat = 37.05,
lng = -122.05,
power = 90,
speed = 90,
utc = '155',
gmt = '156'
WHERE index = (SELECT index
FROM (SELECT max(index) index
FROM location
WHERE location.truckid = '1480c667-0bc9-3c60-85f3-6de3b6cd5ad4') x);