Hi, all.  A late entry on this topic.  I didn't know about the SQL method,
which is pretty nifty.  I would have offered the (perhaps slower?) CF
method, using maxrows in the CFQUERY tag:

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

Matthieu

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


thanks.
thats the answer i was lookin fer ;)

later and g'night gents, this old dog is beat.
tw

-----Original Message-----
From: Mark A. Kruger - CFG [mailto:mkruger@;cfwebtools.com] 
Sent: Friday, October 25, 2002 11:19 PM
To: CF-Talk
Subject: RE: SQL OT: selecting bottom most 10 records


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
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to