SQL query to prepend prefix to existing value in a field

You have no other conditions like update this in all rows then you can try

UPDATE jos_content SET title = CONCAT('Mr. ', title) 

if you want to update conditionally that means particular row needs to update
the you can use

 UPDATE jos_content SET title = CONCAT('Mr. ', title)  where fiedl_name="condition"

eg: UPDATE jos_content SET title = CONCAT('Mr. ', title)  where id = '1'

this will update only one row which contain id=1.

any way before doing this should keep a backup

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)