Select Players While Accruing Points
Posted: Wed Nov 09, 2011 9:43 am
Hi Everyone,
I'm developing a website for a local Poker tournament. The tournament has many locations that members can go to, with leaderboards for Single Game, Location, State & Major.
Each game is inputed by the client by CSV, broken up and put into the database, updating members details, followed by inserting all game specific details into a games table which looks like this:
ID, TIMESTAMP, LOCATION ID, PLAYER ID, POINTS
What I am trying to do is, when viewing the leaderboard for a particular location, the mySQL Select statement needs to somehow accrue points of players, before displaying the final leaderboard in descending order.
This is what I have at the moment, without consideration for adding points of each player:
I just need to know if there is a way to add up points on multiple rows that have a matching LOCATION ID & PLAYER ID, as well as a gereral count of TIMES PLAYED to be computed before outputting results.
Cheers.
I'm developing a website for a local Poker tournament. The tournament has many locations that members can go to, with leaderboards for Single Game, Location, State & Major.
Each game is inputed by the client by CSV, broken up and put into the database, updating members details, followed by inserting all game specific details into a games table which looks like this:
ID, TIMESTAMP, LOCATION ID, PLAYER ID, POINTS
What I am trying to do is, when viewing the leaderboard for a particular location, the mySQL Select statement needs to somehow accrue points of players, before displaying the final leaderboard in descending order.
This is what I have at the moment, without consideration for adding points of each player:
Code: Select all
SELECT * FROM games WHERE locationID = $theLocation ORDER BY points DESCCheers.