SQL query to prepend prefix to existing value in a field SQL query to prepend prefix to existing value in a field sql sql

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 updatethe 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


update tablename set title = 'Mr. ' || title where ....


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

Before testing the query do make a database backup.