rikitons Posted July 9, 2013 Share Posted July 9, 2013 I need to create a PHP script that selects data from MySQL table with multiple priorities?Every MySQL row is an application for several "sports discipline" with sportsman score as the key for rating.Sports columns holds the priority for each participient wish to participiate in exact sport. There are limited places for each sports.That means If his first priority doesn't met (eg. he is 31st in the list, but there are only 30 places available) then the next priority must be as his wish.An example: ID | Name | Tenis | Swiming | Basketball | Runing | Score| ----------------------------------------------------------------------- 1 |John |0 |1 |2 |3 |80 | ----------------------------------------------------------------------- 1 |Bill |1 |2 |3 |4 |65 | ----------------------------------------------------------------------- 1 |Arnold |0 |1 |0 |2 |70 | ----------------------------------------------------------------------- Every disciple has its maximum participients. For an example: $max_tenis = 5; $max_swiming = 8; $max_basketball = 10; $max_runing = 9; I qould like to select all applications for each sports and checking if they are met with the limitation set.So that if I'm selecting all basketballs I must select all other applications with priorities more than the first priority (or second, third...) if the last priority do not met limitation. Quote Link to comment https://forums.phpfreaks.com/topic/279993-selecting-data-with-multiple-priorities-and-limited-max-entries/ Share on other sites More sharing options...
rikitons Posted July 9, 2013 Author Share Posted July 9, 2013 Up Quote Link to comment https://forums.phpfreaks.com/topic/279993-selecting-data-with-multiple-priorities-and-limited-max-entries/#findComment-1440029 Share on other sites More sharing options...
thara Posted July 9, 2013 Share Posted July 9, 2013 I am not clear this. Can you elaborate more? Quote Link to comment https://forums.phpfreaks.com/topic/279993-selecting-data-with-multiple-priorities-and-limited-max-entries/#findComment-1440034 Share on other sites More sharing options...
rikitons Posted July 9, 2013 Author Share Posted July 9, 2013 I meant if I had to select all (for an example) Swimmers I have to select all rows that first priority is swimming AND all other rows where swiming is one of next priorities WHERE previeous (eg first, second) did not met . Quote Link to comment https://forums.phpfreaks.com/topic/279993-selecting-data-with-multiple-priorities-and-limited-max-entries/#findComment-1440036 Share on other sites More sharing options...
trq Posted July 9, 2013 Share Posted July 9, 2013 Up Really? Missed this did you? http://www.phpfreaks.com/page/rules-and-terms-of-service#toc_forum_rules Quote Link to comment https://forums.phpfreaks.com/topic/279993-selecting-data-with-multiple-priorities-and-limited-max-entries/#findComment-1440038 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.