Leburn Posted June 21, 2006 Share Posted June 21, 2006 Hey guys,I currently run a hockey related site using a combo of postnuke (for the news articles) and customized pages (made with MX)I have come across a problem recently. My goal is to add up the Player's stats from each season into a career total.Example:[code]Year GP G A Pts1 10 8 2 102 10 2 10 123 10 4 2 6Total 30 14 14 28 <---[/code]In my database, I have the year-by-year stats for each player in one tablelikeid1-Jaromir Jagr-1-10-8-2-10id2-Jaromir Jagr-2-10-2-10-12id3-Jaromir Jagr-3-10-4-2-6and so on...Hopefully someone can help me out.Also, another little question.How would I get DreamWeaver to display something if a record doesn't existLike say, Player A played the Season, but missed the playoffs. For the playoff stats I want DW to display GP-0, G-1, etc. if a record doesn't exist. As of right now, if a record doesn't exist, the tables are blank.Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/12529-how-to-autosum-or-add-rows-together/ Share on other sites More sharing options...
Leburn Posted June 21, 2006 Author Share Posted June 21, 2006 nevermind, I figured it out by searching for SUMfor those interested the code I used was[code]SELECT SUM(GP) AS GP, SUM(G) AS G, SUM(A) AS A, SUM(P) AS P, SUM(plusminus) AS plusminus, SUM(PIM) AS PIM, SUM(PP) AS PP, SUM(SH) AS SH, SUM(GW) AS GW, SUM(GT) AS GT, SUM(HT) AS HT, SUM(S) AS S, ROUND(AVG(PCTG), 1) AS PCTGFROM stats_seasonWHERE playername = 'colname'[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12529-how-to-autosum-or-add-rows-together/#findComment-48150 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.