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

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

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

javascript - Restarting Supervisor and effect on FlaskSocketIO -