首页 > 数据库技术 > 详细

mysql中update+select

时间:2019-03-18 18:56:26      阅读:292      评论:0      收藏:0      [点我收藏+]

mysql中不支持嵌套查询后更新操作。

但是可以使用inner join来解决自身的更新问题,参考如下例子:

update hera_job a inner join(
select id,concat(su - hadoop -c "source /etc/profile && ,substr(script,3),") as script_new from hera_job
) b set a.script = b.script_new
where substr(a.script,1,2) = sh
and a.id = b.id

 

mysql中update+select

原文:https://www.cnblogs.com/30go/p/10554055.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!