Subject | Re: [firebird-support] Re: How to mix ascending and descending fields in one index |
---|---|
Author | Martijn Tonies |
Post date | 2009-10-09T09:29:44Z |
Hello Set,
pick a random row?
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
> Even if Martijns suggestion was wrong, maybe it could be part of a goodC_INT_ALL only selects the first 10? That's back to square one.
> solution?
>
> with C_INT_ALL(C_INT)
> as (select first 10 C_INT
> from CSV_DATA_TEST2Given that C_INT is not unique, won't the JOIN with "CSV_DATA_TEST2" just
> 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
pick a random row?
> This will, of course, not work on Firebird 1.5 or older versions. I assumeWith regards,
> the speed will vary depending on the selectivity of C_INT and C_FLOAT.
>
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