Subject | Re: [firebird-support] Re: How to mix ascending and descending fields in one index |
---|---|
Author | Geoff Worboys |
Post date | 2009-10-09T08:37:54Z |
Martijn Tonies wrote:
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
> The derived table select takes milliseconds....
> selectBut is that really the same thing?
> *
> from
> ( select first 10 * from
> CSV_DATA_TEST_2
> order by C_INT desc) as first_10
> order by first_10.c_float asc
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