Q:

mysql query for my project (It has only 1 table named judge_review) which needs to sort out top 3 winners

I have tried writing the below query but i just need 3 winners(1st,2nd and 3rd place) and my query has just brought every project in descending order but i need only top 3.
<SELECT judge_review.sub_ID, SUM(judge_review.avgPoints) AS TOTAL FROM judge_review GROUP BY judge_review.sub_ID ORDER BY TOTAL DESC>

A:

You need to apply LIMIT 3
SELECT judge_review.sub_ID,
       SUM(judge_review.avgPoints) AS TOTAL 
       FROM judge_review 
       GROUP BY judge_review.sub_ID 
       ORDER BY TOTAL DESC 
       LIMIT 3

Reference:- Limit Data Selections From a MySQL Database

