Mysql bosses, how can you tell me how to output select "1 Magi 2 Jing 3 Jing 4 Jing 5" as comma-separated results?

I want to output a comma-separated string 1 br 2 3 4 5 as
clipboard.png

select "1,2,3,4,5"

clipboard.png

Mar.28,2021

--SQL
DECLARE @s VARCHAR(100)
DECLARE @sql VARCHAR(1000)
SET @s='1,2,3,4,5'
SET @sql='SELECT NewColumn='''+REPLACE(@s,',','''UNION ALL SELECT ''')+''''
PRINT @sql
EXEC (@sql)

learn more


mysql character stitching can be understood, if you want to group, and then let the data stitching into characters can use the group_concat function, the rest of their own understanding, according to the needs of the choice.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b6af-2c29d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b6af-2c29d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?