作者:甄之恋 | 来源:互联网 | 2023-05-18 05:22
Iamtryingtocreateatableformarksandrankteamindecreasingorder.itriedthis.我正在尝试按降序为分数
I am trying to create a table for marks and rank team in decreasing order. i tried this.
我正在尝试按降序为分数和等级组创建一个表格。我试着这一点。
$q = $db_con-> prepare("
SELECT @s:=@s+1 serial_number, t_name,name,marks FROM team,user,(SELECT @s:=0) AS s WHERE user.u_id=team.u_id ORDER BY marks DESC");
Above query displays result in DESC order of marks but serial numbers get altered. like..
上面的查询显示了标记的DESC顺序,但是序列号被修改。像. .
sr no team name marks
3 A 30
1 B 20
2 C 10
How to get serial numbers in order?
如何将序列号排序?
2 个解决方案