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
Sort according to what should be at the end
选择 名称, 总分 从 提交 内连接 黑客 on 提交.黑客编号 = 黑客.黑客编号 分组 按 提交.黑客编号 筛选 总分 > 50 排序 按 总分 降序
P粉9094764572023-08-31 00:57:15
Your order by should be after your having. Right now:
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