tony - remember the ORDER BY is the controlling execution component in the
query and it's executed before the TOP n are selected.  If you order ASC and
your values are 1,2,3,4,5 you get 1,2,3,4,5 order - selecting the TOP will
start at "1".  If you order desc you will get the order of 5,4,3,2,1 -
selecting TOP in this case will give you values starting at 5. Change your
query to:

<cfquery name="getWriter" datasource="survivorsmiles">
        select TOP 10 (ID), firstname, lastname, email
        from reg
        where id = #getStories.writer_Id#
        order by ID DESC
</cfquery>


goooood luck...

-----Original Message-----
From: Tony Weeg [mailto:tony@;navtrak.net]
Sent: Friday, October 25, 2002 9:09 PM
To: CF-Talk
Subject: SQL OT: selecting bottom most 10 records


brain fartage....never had to make this work...
i only want to select the bottom most ten records
based on a primary key ID field.....

<cfquery name="getWriter" datasource="survivorsmiles">
        select TOP 10 (ID), firstname, lastname, email
        from reg
        where id = #getStories.writer_Id#
        order by ID
        asc
</cfquery>

aint cuttin it? why...cause it doesnt make any sense....just trying to
give you an idea of the field i need and hoping that somehow i can do
this :)

please help.

thanks

..tony

tony weeg
[EMAIL PROTECTED]
www.revolutionwebdesign.com
rEvOlUtIoN wEb DeSiGn
410.334.6331


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to