Jump to content

Archived

This topic is now archived and is closed to further replies.

Leburn

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.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.