Jump to content

How to AutoSum or add rows together


Recommended Posts

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   Pts
1       10   8    2    10
2       10   2   10    12
3       10   4    2     6
Total   30  14   14    28 <---[/code]

In my database, I have the year-by-year stats for each player in one table

like

id1-Jaromir Jagr-1-10-8-2-10
id2-Jaromir Jagr-2-10-2-10-12
id3-Jaromir Jagr-3-10-4-2-6
and 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 exist

Like 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.
Link to comment
Share on other sites

nevermind, I figured it out by searching for SUM

for 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 PCTG
FROM stats_season
WHERE playername = 'colname'[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.