Hi I'm trying to get a total of stats for each year. The problem is that a year can appear more than once in the table. I need to find the total for each year..if there is one record or multiple records.
First row is the Year....the rest are stats
2001 94 0 71 1456 555 14 108 122
2002 94 0 75 1986 647 22 127 149
2003 60 0 76 2332 799 26 161 187
2004 29 0 21 479 125 0 40 40
2004 3 0 49 1528 662 14 95 109
This is my current query:
"SELECT *
FROM nba_playerstats ps, nba_players p, nba_positions pos, nbateams t,
colleges c
WHERE ps.player_id = p.player_id
AND ps.year = $set_selected_year
AND p.position_id = $set_selected_position
AND ps.nbateam_id = t.nbateam_id
AND p.position_id = pos.position_id
GROUP by ps.player_id, ps.year";
With this (based on the example stats above) I get 1 record for 2001, 1 for 2002, 1 for 2003 and 2 for 2004. I want to combine the 2004 records and only return 1...the sum
I've tried using SUM in the query, but then the results returned are the sum of ALL players for that given year...no just the individual player.
Please help!