View Single Post
Old 07-27-2011, 02:28 PM   #7
Brutus
Et tu, Brutus?
 
Brutus's Avatar
 
Join Date: Jul 2006
Location: Atlanta, Ga.
Posts: 8,934
Re: MySQL database questions

Quote:
Originally Posted by IslandRed View Post
That kind of depends on what you mean by "immediately following." SQL queries are set-based and it doesn't have a concept of sequential records except where you might have set up a unique key field to hold the incrementing values.

If you can go into more detail on what you're trying to do, I'll help if I can.
I am trying to extract information from PBP records from the Retrosheet baseball database, in this case.

In their records, it shows a playerID for each base occupied when the player is at-bat as well as the number of outs. What I want to do is find the total bases advanced by all baserunners from a plate appearance, which can only be done based on the circumstances of the plate appearance below it (as it's in sequential order).

So if a batter is up with one out and showing a runner occupying first, I would need to know the bases being occupied beginning the next plate appearance as well as the number of outs and updated score on the next line to know how many bases were gained.

I will send a more detailed example to you if this is still confusing. I might not be explaining it very well.
__________________
"No matter how good you are, you're going to lose one-third of your games. No matter how bad you are you're going to win one-third of your games. It's the other third that makes the difference." ~Tommy Lasorda
Brutus is offline   Reply With Quote