https://stackoverflow.com/questions/4429319/you-cant-specify-target-table-for-update-in-from-clause
mysql不允许这样的事情发生:
update xxxtable
set col = (
select xxx from xxxtable
where ....
)
解决方式是写成这个样子,记得给它取个名字
update xxxtable
set col= (
select a.xxx from
(select * from xxxtable) as a
where ...
)
...