Subject Re: [firebird-support] Re: First word after in alphabetical order
Author Eric SIBERT
> You haven't mentioned whether you have any index(es) on Name that
> could be used in these queries. If you have both an ascending index
> and a descending index on the Name field.
>
> Assuming BOTH these indexes are available, it should run in a few ms

I already have both ascending and descending indexes on NAME. And it
don't run in few ms :-(

>
> SELECT FIRST 11
> ID_NAME
> FROM NAMES
> WHERE NAME>='FISHE'
> ORDER BY NAME;
>
> SELECT FIRST 10
> ID_NAME
> FROM NAMES
> WHERE NAME<'FISHE'
> ORDER BY NAME DESC;

I need also to mention that NAME is defined by :

NAME CHAR(8) CHARACTER SET ASCII NOT NULL,


>
> You may be able to use a union to collect the results together, but I
> don't know if it will like the two different order by statements, so
> maybe the following stored procedure would help.

Sure, I will merge results together but later.

Eric