how can i arrange the output of my data i am using group concat?
i want to arrange the output of my data in descending Here is my code:
$result3 = mysql_query("SELECT grade1.Semester, curriculum.SCode, curriculum.SDesc, curriculum.Lec, curriculum.Lab, curriculum.Units, curriculum.Prereq, GROUP_CONCAT(grade1.Grade1) as Grade1 , students.StudNo, grade1.YearLevel
FROM students
INNER JOIN grade1
ON students.StudNo = grade1.G1StudNo
INNER JOIN curriculum
ON curriculum.SCod开发者_JS百科e = grade1.G1SCode
WHERE StudNo = '$id'
GROUP BY StudNo,SCode ")
Here is the output:
.What i want to happen is 5,5,1.. how can i do that when i am using group_concat?
Check out the docs on GROUP_CONCAT:
GROUP_CONCAT(grade1.Grade1 ORDER BY grade1.Grade1 DESC)
精彩评论