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