Subject Re: [firebird-support] Re: How to mix ascending and descending fields in one index
Author Martijn Tonies
Hello Set,

> Even if Martijns suggestion was wrong, maybe it could be part of a good
> solution?
>
> with C_INT_ALL(C_INT)
> as (select first 10 C_INT

C_INT_ALL only selects the first 10? That's back to square one.

> from CSV_DATA_TEST2
> order by C_INT desc),

> C_INT_UNIQUE(C_INT)
> as (select distinct C_INT
> from C_INT_ALL)



> select first 10 T1.*
> from CSV_DATA_TEST2 T1
> join C_INT_UNIQUE T2 on T1.C_INT = T2.C_INT
> order by T1.c_float asc

Given that C_INT is not unique, won't the JOIN with "CSV_DATA_TEST2" just
pick a random row?

> This will, of course, not work on Firebird 1.5 or older versions. I assume
> the speed will vary depending on the selectivity of C_INT and C_FLOAT.
>

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com