2016-09-23 54 views

回答

1

你有正確的想法。只需使用MySQL的語法:

update mytable 
    set myfield = concat('ABC', myfield) 
    where id = 123 ; 

注意:如果myfield可能是NULL,那麼你可能會想:

update mytable 
    set myfield = concat('ABC', coalesce(myfield, '')) 
    where id = 123 ; 
1

試試這個,使用concat功能:

update mytable set myfield = concat('ABC',myfield) where id = 123