Subject Re: [firebird-support] Re: How to mix ascending and descending fields in one index
Author Martijn Tonies
> Well, it is a design question, I think that not relevant for the solution.
>
> The column "a" is a score calculated from an algorithm.
> The user usually only needs to see the first page, never the page 237232.
> The column "b" is a name. When several records have the same score, the
> second order is the name.

No WHERE clause?

> It is similar (not equal) than google.com, results are ordered by score or
> ranking, the user only needs the see the first or second page.
>
> In few words, a process calculates the score of each record and the user
> wants to see the top 10 records. Remaining records can be ignored.
>
> I can use a computed field, I know, and the problem is solved, but I
> wanted to find how to create a mixed index in FB.

Have you tried a derived table?

select *
from (select first 10 * from mytable order by A) as mytable
order by b


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