mysql - Top 3 results from each player and sort by total -
I need to come up with results that show the sum of the top 3 results from each player and to sort it Yog
Example Table:
David = 12 Mike = 17 John = 20 Bill = 20 David = 12 Mike = 16 John = 18 Bill = 20 David = 11 Mike = 15 John = 16 David = 10 Mike = 14 John = 16 David = 10 John = 15 The results need to be shown as follows:
John = 54 Mike = 50bill = 40 David = 35 I have to Place Ranking for all the events from the Le (simple):
SELECT playerName, SUM (`EventPoints`) DESC I have PHP code Thinking about the following: <`Ol>
Create a table named top3Events Truecover Top 3 Avents at Startup On the table event, the above query Read through the results Use the counter and reset the new player name to each INSERT in the top 3 events when cou nter & lt; = 3 Run this query:
SELECT playerName, SUM (`eventPoints`) Order by 'playname` from' Top 3 Events Group ' (`Event Points') DESC To ensure that this is the correct way to go with it
Comments
Post a Comment