Jump to content

[SOLVED] SQL query - need help to understand


kickoutbettman

Recommended Posts

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 ?

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

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.