SQL update语句 更新和查询同一张表 冲突

#update 和 select在同一张表的时候会显示冲突  报错信息: [Err] 1093 - You can't specify target table 'tb_a' for update in FROM clause

update tb_a set sex='boy' where uid =(select uid from tb_a where name ='cyq')

#解决方式:嵌套多一个查询表

update tb_a set sex='boy' where uid =(select uid from(select uid from tb_a where name ='cyq') as tb_tmp)

上一篇:nginx 配置优化的几个参数


下一篇:MT【318】分式不等式双代换