Leburn
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by Leburn
-
-
Hey guys,
I have a minor problem here. I run a Hockey website where I use a script to parse the stats into the DB. Unfortunately, the Forward and Goaltender stats are stuck together. What I do currently is use 2 tables: 1 for Forwards and the other for Goaltenders, that's not the problem. My problem is my script parses the Forwards into the Goaltender table and vice versa. To combat this I have my script rename the position category to 'A'. By doing this, it allows me to use phpAdmin to use the search to find all entries with position 'A' and then delete the entries accordingly. I then remove duplicate entries afterwards based on the playername category.
[hr]
Anyways my question is how can I create a script that uses a mysql query to do the following:
1. search table players for 'A' in category 'pos'
2. delete all entries (rows) that have 'A' in category 'pos'
3. delete duplicate entries based on category 'playername'
If someone can make me this script, I can then duplicate it for the goalie table myself. -
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] -
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.
How to delete DB entries based on LIKE clauses
in MySQL Help
Posted
It is a Fantasy based Hockey League using real players and teams (although we have contracted/added real teams). We use a text-based simulator called FHL Sim (Fantasy Hockey League Simulator) available @ www.fhlsim.com.
This sim is basically takes the life of a GM were you trade, draft, sign, release players. Your ultimate goal is obviously to win the Cup. Basically consider it the manager part of the EA Sports NHL series, but with 30 real GMs.
One of the nice features is the simulator outputs the statistics to html pages.
Now what I do is use a script to parse the data from these pages and place them into a DB. The script looks through the html source code to find the various stats.
I personally did not make the script from scratch, I was fortunate enough to have someone else send me a sample, which I then worked on for my league.
[hr]
Now I think one of the duplicate issues is the fact that some players play for more than one team and therefore have 2 or more entries. The only issue here is for the current season stats, were all I care about is the latest entry for each player. However, I believe this issue will be resolved in our upcoming season as we will be doing the transactions differently.
Anyways, if you want to check out some examples of what I am talking about feel free to reply here, and I can post a few links to the stat pages, my parsing script, etc.