mysql - Delete a specific value from a string ( string contains comma saperated values) -


for example if have table structure this.

table 1     id name value      001 rajesh 90,100,210,400     002 suresh 100,400,300,66     003 mahesh 200,500     004 virat 400,578,57 

how can delete 400 suresh ?

delete value ="400" table1 name = 'suresh' 

this doesnt work.

i recommend splitting values second table related via person's id. however, can use following query current situation:

update table1 set value = trim(both ',' replace(concat(',', value, ','), ',400,', ',')) name = 'suresh' 

here's sql fiddle. reference, see mysql's string functions


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -