我需要运行此查询:
UPDATE TempRH T
JOIN (
SELECT offices_id,MAX(Poids)AS Poids
FROM TempRH
GROUP BY
offices_id
)T1
ON T1.offices_id=T.offices_id
SET T1.Poids=0
但在执行时会出错:
#1288-The target table T1 of the UPDATE is not updatable.
任何解决方案?
答案 0 :(得分:4)
对我来说,一个小小的改变会解决这个问题吗?
UPDATE TempRH T
JOIN (
SELECT offices_id,MAX(Poids)AS Poids
FROM TempRH
GROUP BY
offices_id
)T1
ON T1.offices_id=T.offices_id
SET T.Poids=0
将T1.Poids
更改为T.Poids
。因此,您SET
要TABLE
UPDATE
的值{{1}}。{