Jump to content

How to delete DB entries based on LIKE clauses


Leburn

Recommended Posts

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

Well first I should tell you what my site is about.

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.
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.