mysql update select

oracle 中:

update table  t set t.status = 'x' where t.status='y'

在mysql中则需要使用

update table t inner join (select 'x' status from dual) c set t.status = c.status where t.status = 'y'

需要设置的列值

inner join (select 'x' status from dual) c中的c.status

where条件子句

t.status = 'y' 

猜你喜欢

转载自wwwiteye.iteye.com/blog/2204417