Subject Re: [firebird-support] Does FB allow ORDER BY in subselects?
Author Helen Borrie
At 11:09 PM 20/02/2004 +0000, you wrote:
>Hi,
>
>I have a table with usernames and times when they last accessed a
>system (a timestamp). I need to have the last 10 users to access the
>system in alphabetical order, so I figured I'd do something like
>
>SELECT * FROM (SELECT FIRST 10 USERNAME FROM USERS ORDER BY ACCESS
>DESC) ORDER BY USERNAME;
>
>but that didn't work. Is something like this possible at all?

Fb currently doesn't support SELECT .. FROM (SELECT...) at all. Coming in
the Fb 2 development. Actually, your query wouldn't get the *last* 10 users
anyway.

SELECT FIRST 10 * FROM USERS
ORDER BY ACCESS DESC

A descending index on ACCESS is called for here.

/heLen