您的位置:首页 > 数据库 > MySQL

Mysql: Table name is specified twice, both as a target for UPDATE and as a separate source for data

2018-02-27 14:25 495 查看
执行SQL:
update table1 set status2=1 where id IN( select max(id) from table1 where cid=1 group by link)  ;
出现错误:
Mysql: Table name is specified twice, both as a target for UPDATE and as a separate source for data

将SQL修改为:
update table1 set status2=1 where id IN(select * from ( select max(id) from table1 where cid=1 group by link) as TEMP ) ;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐