Re: [Q] Daves's top 10 SQL question
From: Nick Gallemmo <ndg_at_west.enterworks.com>
Date: 1996/08/21
Message-ID: <321B3A98.3F16_at_west.enterworks.com>#1/1
Date: 1996/08/21
Message-ID: <321B3A98.3F16_at_west.enterworks.com>#1/1
John Griffiths wrote:
>
> SELECT
> NAME
> ,SCORE
> FROM
> StupidPetTricks
> WHERE
> ROWNUM < 11
> ORDER BY
> SCORE DESC;
>
> Regards
> John Griffiths
A more generic solution would be:
SELECT NAME, SCORE FROM STUPIDPETTRICKS WHERE SCORE => (SELECT SCORE FROM STUPIDPETTRICKS WHERE ROWNUM = 10 ORDER BY SCORE DESC) ORDER BY SCORE DESC;
However, this would not work if there were less than 10 rows and it presumes that more than 10 is ok if the last rank has ties. Received on Wed Aug 21 1996 - 00:00:00 CEST