Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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