P粉1808446192023-08-09 16:23:28
Add a leading comma and space before your value, then add a trailing comma - then replace , Holidays, with , Holiday,.
nRemove leading and trailing commas in the result again afterwards
SELECT TRIM(',' FROM REPLACE(CONCAT(', ', Tags, ','), ', Holidays,', ', Holiday,'))
Example of using specific values No Holidays, Holidays, Holidays 2023, Holidays, Test, Holidays
inserted directly instead of getting it from the holidays column:
SELECT TRIM(',' FROM REPLACE( CONCAT(', ', 'No Holidays, Holidays, Holidays 2023, Holidays, Test, Holidays', ','), ', Holidays,', ', Holiday,') )
The result will be:
No Holidays, Holiday, Holidays 2023, Holiday, Test, Holiday