Gaurav Rathore
Gaurav Rathore

Reputation: 57

mysql data updation based on previous record

I am new to database and using myPhpAdmin, in my table there is field notification_icon which include icon address, i put all image icons but i forget to add path of these icons which is common for all,

column with image name only

column after image path added, i did this manually

Is there any query to update image path in all, I tried:

UPDATE `notifications_notificationconfiguration` SET `notification_icon`="directory_path/"+`notification_icon`;

But this make all fields 0

Upvotes: 0

Views: 37

Answers (1)

Irfan Ashraf
Irfan Ashraf

Reputation: 607

Query you have will work for numeric data types eg int but for string data types eg varchar You should use CONCAT function.

UPDATE `notifications_notificationconfiguration` 
SET `notification_icon`= CONCAT("directory_path/",notification_icon);

SQL Fiddle Here

Upvotes: 1

Related Questions