分组
group_concat
语法: group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator ‘分隔符’])
-- type 分组,age 字段合并(,分割)select group_concat(age) from tab group by type;1 20,30,402 24-- type 分组,age 字段合并,指定 # 分割select group_concat(age separator '#') from tab group by type;1 20#30#402 24-- type 分组,age 字段合并,按照 id 倒序,指定 # 分割select group_concat(age order by id desc separator '#') from tab group by type;1 40#30#202 24
