1. 程式人生 > >mysql中update+select

mysql中update+select

mys concat clas bsp source 但是 更新問題 mysql bold

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