Page 1 of 1

Ideas on comparing mysql query results.

Posted: Fri Jun 10, 2011 2:18 pm
by cwheel3915
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.

Re: Ideas on comparing mysql query results.

Posted: Sat Jun 11, 2011 1:41 pm
by getmizanur
what does it mean by 'common races'

'common races' - assuming common races means
- - 'gloomy lightning' racing with other horses other than 'fancy boy' and 'happy lad'
- - 'fancy boy' racing with other horses other than 'gloomy lightning' and 'happy lad'
- - 'happy lad' racing with other horses other than 'gloomy lightning' and 'fancy boy'

find the frequency of gloomy lightning coming 1st, 2nd and 3rd
find the frequency of fancy boy coming 1st, 2nd and 3rd
find the frequency of happy lad coming 1st, 2nd and 3rd

and then compare your result with each other horses

hope that helps!