Comparing query results to previous array
Posted: Mon May 23, 2005 9:48 am
Hi,
I have an application I'm working on that posts the results of various races. All of the race results are stored in a table and I am pulling the results to display on a page.
Here's my challenge:
1) The page displays the top female and the top male (or sometimes the top 3 for each sex).
2) Then it breaks down the various age groups and shows the top 3 in each age group for each sex. The challenge is that if you are in the top three overall, you cannot be in the top 3 in your age group.
So for the top overall, I have a query with a LIMIT of 3. Works fine.
What I need to be able to do is then compare the results for each age group with the results in the top 3 overall and if the racer exists in the top 3 overall, then move on to the next racer and check them.... etc...
Does that make sense?
What is the best way to do this? I am sure that I can compare the age group row results to the results in the array from the first query - I'm just now sure how to go about doing this?
Can someone please point me in the right direction? I certainly don't want anyone to write the code for me - but I'm not sure of the syntax needed to compare to previous array results.
Thanks so much!
I have an application I'm working on that posts the results of various races. All of the race results are stored in a table and I am pulling the results to display on a page.
Here's my challenge:
1) The page displays the top female and the top male (or sometimes the top 3 for each sex).
2) Then it breaks down the various age groups and shows the top 3 in each age group for each sex. The challenge is that if you are in the top three overall, you cannot be in the top 3 in your age group.
So for the top overall, I have a query with a LIMIT of 3. Works fine.
What I need to be able to do is then compare the results for each age group with the results in the top 3 overall and if the racer exists in the top 3 overall, then move on to the next racer and check them.... etc...
Does that make sense?
What is the best way to do this? I am sure that I can compare the age group row results to the results in the array from the first query - I'm just now sure how to go about doing this?
Can someone please point me in the right direction? I certainly don't want anyone to write the code for me - but I'm not sure of the syntax needed to compare to previous array results.
Thanks so much!