BigToque
09-05-2006, 05:04 AM
I'm having a hell of a time trying to get this to work and I'm sure it's a relatively simple solution...
I'm managing the stats for my hockey team and in this particular select statement, I'm trying to sort the top point scorers in a single game.
IE, I have 1 player right now who holds positions #1 and #3 for most points in a single game, but my code sums the points from every game he's played in.
SELECT players.PID PID, players.f_Name fName, players.l_Name lName, SUM (player_stats.G + player_stats.A) PTS
FROM players, player_stats
WHERE players.PID = player_stats.PID
AND year = 2005
AND league = 'Spring'
GROUP BY players.PID ORDER BY PTS DESC
How can I modify this so that G and A are summed on only single records, and not all the records?
I'm managing the stats for my hockey team and in this particular select statement, I'm trying to sort the top point scorers in a single game.
IE, I have 1 player right now who holds positions #1 and #3 for most points in a single game, but my code sums the points from every game he's played in.
SELECT players.PID PID, players.f_Name fName, players.l_Name lName, SUM (player_stats.G + player_stats.A) PTS
FROM players, player_stats
WHERE players.PID = player_stats.PID
AND year = 2005
AND league = 'Spring'
GROUP BY players.PID ORDER BY PTS DESC
How can I modify this so that G and A are summed on only single records, and not all the records?