Knut Anders Hatlen <[EMAIL PROTECTED]> writes:

> caxo <[EMAIL PROTECTED]> writes:
>
>> I have to take a certain number of rows ordered by a field.
>> And the derby say me error: Syntax error: Encountered "ORDER"
>>
>> SELECT * FROM (
>>    SELECT ROW_NUMBER() OVER () AS R,
>>     playerId, 
>>     playerName, 
>>     points 
>>    FROM ranks 
>>    ORDER BY points DESC
>>    )
>>  AS TR WHERE R <= 10
>>
>> This is my query and I'm not shure is it a bug or I'm not doing something
>> right.
>
> It should work if you move the ORDER BY clause into the outer SELECT,
> like this:
>
>   SELECT * FROM (
>     SELECT ROW_NUMBER() OVER () AS R,
>            playerId,
>            playerName,
>            points
>     FROM ranks) AS TR
>     WHERE R <= 10 ORDER BY points DESC

Oops, sorry that won't work... At least, it won't give you the results
you want.

-- 
Knut Anders

Reply via email to