P粉1808446192023-08-09 16:23:28
在您的值之前添加一个前导逗号和空格,然后添加一个尾随逗号-然后将其中的, Holidays, 替换为 , Holiday,。
n在之后再次删除结果中的前导和尾随逗号
SELECT TRIM(',' FROM REPLACE(CONCAT(', ', Tags, ','), ', Holidays,', ', Holiday,'))
使用特定值示例 No Holidays, Holidays, Holidays 2023, Holidays, Test, Holidays
inserted directly instead of getting it from the 直接插入而不是从标签列中获取的假期 column:
SELECT TRIM(',' FROM REPLACE( CONCAT(', ', 'No Holidays, Holidays, Holidays 2023, Holidays, Test, Holidays', ','), ', Holidays,', ', Holiday,') )
会导致的结果为:
No Holidays, Holiday, Holidays 2023, Holiday, Test, Holiday