美文网首页
MySQL group_concat()

MySQL group_concat()

作者: 河南大叔闯天涯 | 来源:发表于2019-04-16 10:03 被阅读0次

group_concat语法: 

group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator ‘分隔符’])

/*SUBSTRING_INDEX以逗号分隔,取第一个值*/

select SUBSTRING_INDEX(GROUP_CONCAT(stuName ORDER BY score ASC),',',1),

  min(score) as score,

  course

from

  grade1

group by

  course; 

---------------------

作者:无形myself

来源:CSDN

原文:https://blog.csdn.net/u011280342/article/details/78285608

版权声明:本文为博主原创文章,转载请附上博文链接!

相关文章

网友评论

      本文标题:MySQL group_concat()

      本文链接:https://www.haomeiwen.com/subject/ohnyxqtx.html