asmith Posted August 26, 2009 Share Posted August 26, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/171938-looking-for-the-best-possible-query/ Share on other sites More sharing options...
fenway Posted September 7, 2009 Share Posted September 7, 2009 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) I don't follow your second example. Quote Link to comment https://forums.phpfreaks.com/topic/171938-looking-for-the-best-possible-query/#findComment-914119 Share on other sites More sharing options...
asmith Posted September 28, 2009 Author Share Posted September 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/171938-looking-for-the-best-possible-query/#findComment-926219 Share on other sites More sharing options...
fenway Posted October 5, 2009 Share Posted October 5, 2009 And what query produces that output? Quote Link to comment https://forums.phpfreaks.com/topic/171938-looking-for-the-best-possible-query/#findComment-930750 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.