美文网首页
MySQL-[HY000][1093] You can't sp

MySQL-[HY000][1093] You can't sp

作者: hisenyuan | 来源:发表于2018-12-14 16:11 被阅读0次

[HY000][1093] You can't specify target table 't_hisen' for update in FROM clause

原因:

update t_hisen
set name = 'hisen'
where id in (select id from t_hisen where age = 18)

类似上面的sql,mysql update不允许表名既在update中又在子查询中。
Oracle是可以的

解决办法只有先查询,在拿出数据放在where子句中

相关文章

网友评论

      本文标题:MySQL-[HY000][1093] You can't sp

      本文链接:https://www.haomeiwen.com/subject/sfpghqtx.html