MySQL group_concat()

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())