MySQL: Sort GROUP_CONCAT values MySQL: Sort GROUP_CONCAT values mysql mysql

MySQL: Sort GROUP_CONCAT values


Sure, see http://dev.mysql.com/doc/refman/...tions.html#function_group-concat:

SELECT student_name,  GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR ' ')  FROM student  GROUP BY student_name;


Do you mean to order by?

SELECT _key,            COUNT(*) as cnt,            GROUP_CONCAT(_value ORDER BY _value SEPARATOR ', ') as value_list      FROM group_concat_test      GROUP BY _key      ORDER BY _key;