i have a table called player_stats and here are the headers in that table
id
playerid
goals
assists
goalsa
shotsa
minutes
xtra1
xtra2
xtra3
xtra4
xtra5
gminutes
played
game_id
team_id
div_id
seasonid
here is the code i use to get the stats
//get player stats
$stats_sql = "SELECT * FROM player_stats,teams,players WHERE player_stats.seasonid = '".$sid."' AND "
."teams.id = player_stats.team_id AND "
."players.id = player_stats.playerid AND players.position != 'G'";
$result_stats = mysql_query("$stats_sql");
if(!$result_stats) { echo mysql_errno().": ".mysql_error()."<br>"; }
$statcount = mysql_numrows($result_stats);
now heres the dilema. if a player gets traded or moved to another team all stats show up with his current team. almost like the code is addomg up by playerid.
what i would like it to show is all teams that player played with in the current season and them total them up.
Year------Team---------GP--G--A---Pts
2007-08 San Jose-----20--3--16--19
2007-08 Buffalo--------63--5--38--43
2007-08 Total Buf/SJ--83--8--54--62