我正在努力为每项活动筹集总奖金。我想用总奖金对结果进行排序,但这似乎并不奏效。我只能按活动分组,或者按总金额订购(这只是给了我总金钱栏)。
这是查询和表格:
SELECT event_id, SUM(money) as 'total money'
FROM prize
GROUP by event_id
ORDER by 'total money' desc;
感谢
答案 0 :(得分:0)
正如@juergen所说,这对你有帮助。
SELECT event_id, SUM(money) as `total money`
FROM prize
GROUP by event_id
ORDER by `total money` desc;