SQL Statement Merge Column Values Combine multiple values of a column into one row

Oralce writing:

select WM_CONCAT(A.title) as citys from tmpcity A

 

sql server writing:

select stuff((select ','+A.title from tmpCity A FOR xml PATH('')), 1, 1, '') as citys

 

MySQL writing:

select GROUP_CONCAT(A.title) as cities from tmpcity A; --default comma separated
select GROUP_CONCAT(A.title SEPARATOR ' ') as cities from tmpcity A; --separated by spaces

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326506887&siteId=291194637