MySQL中GROUP_CONCAT中排序

原来GROUP_CONCAT中,是支持GROUP内排序的,自己好土。。

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

Leave a Reply

Your email address will not be published.