This should work for you.
Select *
From (Select rownum rnum, p.* From (
SELECT count(1) Over() totalCount, email, firstname
FROM Carma_Contact
) p
)
Where rnum >= (totalCount - 50);
Just replace the 50 with the number of rows back from the total that you
want to select.
Hope that helps.
Nik
On Thu, Mar 12, 2009 at 6:59 AM, Ian Skinner <[email protected]> wrote:
>
> I would like to select the last n records from a table as defined by a
> sequence field.
>
> I tried SELECT stuff FROM aTable WHERE rownum < n ORDER BY query_seq desc.
>
> But this just sorts the first n records in descending order where I want
> the last n records.
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320457
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4