I need one help.I need to join one new value with existing value present inside database column using PHP and Mysql.I am explaining my table below.
db_admin
id supplier_id
1 2,3,4,5,6
Here in supplier_id
column i have some value like 2,3,4,5,6
.suppose i need to add another value lets say 7
with the existing supplier_id
with comma operator finally the result will be 2,3,4,5,6,7
So i need query for that.Please help me.
Just Use Following query using Concat
UPDATE `db_admin` SET `supplier_id` = concat(supplier_id, ',7') WHERE `id` = 1;
As Gordon Linoff stated you shouldn't try to handle it in this manner. Make a proper linking table between this table and the supplier table.
https://en.wikipedia.org/wiki/Associative_entity
You can add the 7 now, but tomorrow you want to remove the 4 and then you have a new problem.