P粉8771147982023-08-31 15:51:51
Order by should be in last
select name, sum(score) from submissions inner join hacker on submissions.hacker_id = hacker.hacker_id group by submissions.hacker_id having sum(score) > 50 order by sum(score) desc
按照应该在最后进行排序
选择 名称, 总分 从 提交 内连接 黑客 on 提交.黑客编号 = 黑客.黑客编号 分组 按 提交.黑客编号 筛选 总分 > 50 排序 按 总分 降序
P粉9094764572023-08-31 00:57:15
您的order by应该在您的having之后。即:
select name, sum(score) from submissions inner join hacker on submissions.hacker_id = hacker.hacker_id group by submissions.hacker_id having sum(score) > 50 order by sum(score) desc