Subject | Re: [firebird-support] whats the opposite of first? |
---|---|
Author | Helen Borrie |
Post date | 2006-10-17T23:00:42Z |
At 07:24 AM 18/10/2006, you wrote:
ORDERED set. So, create a DESC index on the ordering field and order
it DESC. Then SELECT FIRST 5 returns the set you want.
IOW, the ORDER BY clause is what determines "first". It's a
side-effect that the set for an ascending slice comes in ascending order. :-)
You want to return a descending set that has its rows in ascending
order, don't you? :-) With derived table support in Fb 2.0, it is
doable (if horrible!) I guess you could write a selectable SP to
achieve that in 1.5, though the logic boggles the mind at 9 a.m...
./heLen
>hi,The purpose of SELECT FIRST...SKIP is to return a slice from an
>
>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)
ORDERED set. So, create a DESC index on the ordering field and order
it DESC. Then SELECT FIRST 5 returns the set you want.
IOW, the ORDER BY clause is what determines "first". It's a
side-effect that the set for an ascending slice comes in ascending order. :-)
You want to return a descending set that has its rows in ascending
order, don't you? :-) With derived table support in Fb 2.0, it is
doable (if horrible!) I guess you could write a selectable SP to
achieve that in 1.5, though the logic boggles the mind at 9 a.m...
./heLen