How can I write this query to filter out only results with a sum greater than 50? I can't get it to work using having or sum, but I'm sure there is some way.
select name, sum(score) from submissions inner join hacker on submissions.hacker_id = hacker.hacker_id group by submissions.hacker_id order by sum(score) desc having sum(score) > 50
Here is an example with a table (there is nothing special about the table, this query runs without the last row, but returns everyone's score and name): http://sqlfiddle.com/# !9/7a660d/16
Order by should be in last
Sort according to what should be at the end
Your order by should be after your having. Right now: