Subject Re: Does FB allow ORDER BY in subselects?
Author h_urlaf
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> >SELECT * FROM (SELECT FIRST 10 USERNAME FROM USERS ORDER BY ACCESS
> >DESC) ORDER BY USERNAME;
>
> the Fb 2 development. Actually, your query wouldn't get the *last*
> 10 users anyway.

No? Why not? I thought the ORDER BY ACCESS DESC would return the
latest users first, then I pick the first 10 from those... no?

> SELECT FIRST 10 * FROM USERS
> ORDER BY ACCESS DESC

Does the '*' vs 'USERNAME' nake the difference here? Is there another
way to achieve what I want, maybe something with a temporary table
(although I couldn't find any info on temp. tables so far).

> A descending index on ACCESS is called for here.

For performance reasons, or in order to achieve the functionality at
all?

Thanks,
Emiliano