Subject RE: [firebird-support] select first & union
Author sasha
>
> if I have
>
> select first 25 skip 25 id from ......
> union
> select count(*) from ....
> order by 1
>
> what should the order by apply to, I want it to apply to the
> first select so the first/skip is correct but syntax does not
> allow an order by until the end due to the union. Should I be
> approaching this differently.
>
If I understood, you are trying to to put count(*) at the end, right? If
that's so
then this is the solution:

select first 25 skip 25 1 order_by, result from ...
union
select 2, count(*) from ...
order by 1

Sasha