Subject RE: [firebird-support] whats the opposite of first?
Author Alan McDonald
> hi,
>
> when i want to select the first 5 entries from a table i do something
> like:
>
> select first 5 field from table order by field ascending
>
>
> now, what do i do if i want to select the LAST 5 ? (but keeping the
> same order)
>
> select last 5 field from table order by field ascending
>
> doesnt work (fb 1.5)
>
> thanx
>
> martin

you need a "paging" stored procedure, search this group for paging select -
there has been enough discussion on this topic. then you need to ask this SP
to give you the last page. In short it does a count(*), then with teh page
size you pass it, calculates which records to give you. then it does a
select first n skip n fieldlist from etc with the correct values for n
Alan
PS - very costly