I need to replace a specific value in a comma separated list.
Let say for example that i have the column Tags populated as following: Holidays, Holidays 2023, Test.
I need to replace only the word 'Holidays' with 'Holiday' but i don't want to replace as well 'Holidays 2023' with 'Holiday 2023'.
I've tried to use replace function and LIKE in the WHERE clause but it doesn't work, i'm using PHP for back-end but i don't know how i can avoid this situation.
Here the SQL that i have used:
UPDATE Expenses SET Tags = REPLACE(Tags, :original, :replace), Updated_date = :update_date WHERE Id_user = :id_user AND Tags LIKE :original_like
- :original contain the list: Holidays, Holidays 2023, Test
- :replace contain only the word Holiday