我如何安排我使用组连接的数据的输出?
我想按降序排列数据的输出 这是我的代码:
$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.SCode = grade1.G1SCode
WHERE StudNo = '$id'
GROUP BY StudNo,SCode ")
这是输出: 。
我想要发生的是 5,5,1.. 当我使用 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.SCode = 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 GROUP_CONCAT:
Check out the docs on GROUP_CONCAT: