当前位置:Gxlcms > 数据库问题 > Mysql concat() group_concat()用法

Mysql concat() group_concat()用法

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

order by column asc/desc separator ‘分隔符‘ ) 最关键的是红色部分  其他可选 distinct去除重复值  order by column 按照 column排序ssc升序 desc降序

测试:如下

select id,name,group_concat(hobby separator ‘,‘) as occu from test group by name

技术图片

 

 

 首先把hobby换成数字 方便测试 排序

技术图片

 

 

 select id,name,group_concat(hobby order by hobby asc separator ‘,‘) as occu from test group by name

技术图片

 

 

  select id,name,group_concat(hobby order by hobby desc separator ‘,‘) as occu from test group by name

技术图片

 

 

 select id,name,group_concat(distinct hobby order by hobby asc separator ‘,‘) as occu from test group by name

技术图片

 

Mysql concat() group_concat()用法

标签:bsp   tor   obb   lazy   mic   排序   with   分隔符   图片   

人气教程排行