Ideas on comparing mysql query results.
Posted: Fri Jun 10, 2011 2:18 pm
Alright, I have some code written for this already, but its incomplete, and im almost certain its not done in a lets say "good" way.
Im not asking anyone to write any code for me, but only to maybe give comments on how they might consider going about doing this.
here is my situation I have a database of horse race results from a game, in the game you make trifecta picks 1st, 2nd, 3rd place. Im trying to come up with a script to make the picks for me.
The database looks like this.
Raceid - First - Second - Third
11234 - Gloomy lightning - Fancy Boy - Happy lad
11235 - Gloomy lightning - Fancy Boy - Happy lad
11236 - Gloomy lightning - Fancy Boy - Happy lad
In the game alot of the horses never place in a race period. So what I had in mind was something like this.
1. get the number of 1st,2nd,3rd place finishes a horses have.
2. check all the horses entered, and mark those that have actually managed to ever win a race as possible winners.
3. check the possible winners against each other for common races, and find out how they placed in said race. then output 1st, 2nd, 3rd place based on that. or if no common races then just put whichever horse has the most 1st places as 1st, whichever has the 2nd most 1st places, and most 2nd places among the remaining horses as 2nd place. and which ever has the 3rd most 1st places, and 2nd most second places, and most 3rd places as 3rd.
1 and 2 are no problem. Its when I get to 3 that im getting stumped. I hope that made sense.
Im not asking anyone to write any code for me, but only to maybe give comments on how they might consider going about doing this.
here is my situation I have a database of horse race results from a game, in the game you make trifecta picks 1st, 2nd, 3rd place. Im trying to come up with a script to make the picks for me.
The database looks like this.
Raceid - First - Second - Third
11234 - Gloomy lightning - Fancy Boy - Happy lad
11235 - Gloomy lightning - Fancy Boy - Happy lad
11236 - Gloomy lightning - Fancy Boy - Happy lad
In the game alot of the horses never place in a race period. So what I had in mind was something like this.
1. get the number of 1st,2nd,3rd place finishes a horses have.
2. check all the horses entered, and mark those that have actually managed to ever win a race as possible winners.
3. check the possible winners against each other for common races, and find out how they placed in said race. then output 1st, 2nd, 3rd place based on that. or if no common races then just put whichever horse has the most 1st places as 1st, whichever has the 2nd most 1st places, and most 2nd places among the remaining horses as 2nd place. and which ever has the 3rd most 1st places, and 2nd most second places, and most 3rd places as 3rd.
1 and 2 are no problem. Its when I get to 3 that im getting stumped. I hope that made sense.