I want to concatenate specific text before existing text in database column, where field value is not empty
For instance - i have column v_small_img - where there are many fields which are blank and some have values
I need to append in text only in fields which have values and not to append text in fields which are blank
I have reached in to this,
UPDATE `#_toys_variants` SET v_small_img=CONCAT('images/uploads/variants/',v_small_img);
You can filter the non empty
UPDATE `#_toys_variants` SET v_small_img = CONCAT( 'images/uploads/variants/', v_small_img ) WHERE v_small_img <> ''
In order to rollback the empty value in
v_small_img field which might hold this value
'images/uploads/variants/' because of your above query :
UPDATE `#_toys_variants` SET v_small_img = '' WHERE v_small_img = 'images/uploads/variants/'