随笔 - 7  文章 - 1  评论 - 0  阅读 - 1501 

mysql出现You can’t specify target table for update in FROM clause 这个错误的意思是不能在同一个sql语句中,先select同一个表的某些值,然后再update这个表。

====查询结果赋值变量,再更新:

select @audit_id := max(audit_id) from ihq_auditing_user where name = 'asdfg' group by name;
update ihq_auditing_user set status=3, audit_status=3,update_notes=2 where audit_id=@audit_id;

posted on   别的山的石头  阅读(156)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示