Jump to content

Looking for the best possible query


asmith

Recommended Posts

Hi,

 

I have this table that has recorded the times which each member has done in a sport:

 

ID_MEMBER    ID_SPORT  hisTime

12                32            45.25

14                51            41.52

 

For the member page, I want to run a query to find out if the specified member is being 1st, 2nd or 3rd in EACH ID_SPORT. (kinda like checking to see if he has any medal)

 

Its possible that a member have 2 or more times per ID_SPORT.

 

For example if the member have the 1st and 2nd time of a ID_SPORT he will be counted as 1st (But not second), and the third time will be calculated as 2nd. (If it is by other member)

 

This table's gonna be so big. Over 10, 000 rows.

How can I write the fastest query possible?

 

Thanks for your time 

 

 

Link to comment
https://forums.phpfreaks.com/topic/171938-looking-for-the-best-possible-query/
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

it may be like this:

 

ID_MEMBER    ID_SPORT  hisTime

12                32            45.25

12                32            41.52

14                32            46.12

17                32            50.01

 

Member 12 has the 1st and 2nd place. But I just want to count his best time and ignore his other attempts. So member 12 must be counted as 1st, member 14 as 2nd and member 17 as 3rd.

Archived

This topic is now archived and is closed to further replies.

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