kickoutbettman Posted July 13, 2009 Share Posted July 13, 2009 Good day all, I'm trying to make a specific query but i'm not sure if it's feasible or not. Basically, I have one table which represent a list of golf game. I'm trying to calculate the handicap which consist to take the BEST 10 games of the LAST 20 games. Is there a way to have one query to give me the result ? The important columns in the table are : idGame date (to calculate the last 20) score (to calculate the best 10 of the last 20) Anybody can help me ? Quote Link to comment https://forums.phpfreaks.com/topic/165804-solved-sql-query-need-help-to-understand/ Share on other sites More sharing options...
kickstart Posted July 13, 2009 Share Posted July 13, 2009 Hi Bit clunky, but something like:- SELECT * FROM (SELECT * FROM (SELECT * FROM idGame ORDER BY `date` DESC LIMIT 0,20) lastGames ORDER BY score DESC LIMIT 0,10) bestGames Just put the outer select there to make it obvious if you want to do a calculation there. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/165804-solved-sql-query-need-help-to-understand/#findComment-874559 Share on other sites More sharing options...
kickoutbettman Posted July 13, 2009 Author Share Posted July 13, 2009 Great, sound good to me, I'll try this tonight, but i'm pretty sure it will work. I knew there was a simple trick. Thank you very much So this is solved Quote Link to comment https://forums.phpfreaks.com/topic/165804-solved-sql-query-need-help-to-understand/#findComment-874560 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.