Subject Re: [firebird-support] Re: How to mix ascending and descending fields in one index
Author Geoff Worboys
Martijn Tonies wrote:
> The derived table select takes milliseconds.
...
> select
> *
> from
> ( select first 10 * from
> CSV_DATA_TEST_2
> order by C_INT desc) as first_10
> order by first_10.c_float asc

But is that really the same thing?

select first 10 * from
CSV_DATA_TEST_2
order by C_INT desc

does not (necessarily) return the same 10 rows as

select first 10 * from
CSV_DATA_TEST_2
order by C_INT desc, c_float asc


If there were 50 rows all with C_INT = 1
then your statement will return a random(ish)
selection of 10 of them.

If there was some known limiter value for C_INT
then a WHERE clause could be used... but I suspect
that would work without derived tables too.

--
Geoff Worboys
Telesis Computing