当前位置:Gxlcms > 数据库问题 > SQL语句:合并列值(将一列的多个值合并成一行)

SQL语句:合并列值(将一列的多个值合并成一行)

时间:2021-07-01 10:21:17 帮助过:296人阅读

默认的逗号分隔 select GROUP_CONCAT(A.title) as citys from tmpcity A; --用空格分隔 select GROUP_CONCAT(A.title SEPARATOR ) as citys from tmpcity A;

oralce写法:

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

sql server写法:

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

 

SQL语句:合并列值(将一列的多个值合并成一行)

标签:描述   server   效果   f11   tor   images   font   多个   插入   

人气教程排行