Subject Re: [firebird-support] select first & union
Author Nick Upson
the objective is to return, in one statement, both table id's 26 to
50, other fields from thos records and the count. The count is
differentiated by all additional fields being 0, which I didn't show
in an attemopt to simplfy

On 23/08/07, Helen Borrie <helebor@...> wrote:
> At 06:51 PM 23/08/2007, you wrote:
> >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.
> True.
> >Should I be approaching this differently.
> One is forced to ask, approaching *what* differently? You want a
> list of up to 26 numbers, of which the first 25 are table id's and
> the 26th is a count of something with nothing to differentiate it
> from the 25 id's except that it will be (a) last or (b) missing (if
> there is an id with the same number as the count). What's the objective?
> ./heLen