mysql中使用groupby之后,取出每一列的组内所有值,可以用Group_CONCAT().
GROUP_CONCAT中,是支持GROUP内排序的
SELECT student_name,
SELECT
student_name,
GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR ' ')
GROUP_CONCAT(
DISTINCT
test_score
ORDER
BY
DESC
SEPARATOR
' '
)
FROM student
FROM
student
GROUP BY student_name;
GROUP
student_name;
很有用的方法。