A different route to the same means:

<cfquery name="getrecords" datasource="datasourcename">
  SELECT top 3 *
  FROM tbl_whatever
  ORDER BY primarykey DESC
</cfquery>

  In this case, the query only returns three items.  In the case below 
(where maxrows was used) all items in the table are returned, but only 
three are passed to ColdFusion.  In this case, using 'top' is more 
efficient than using maxrows.

At 09:16 AM 08/14/2001 -0400, you wrote:
>omg... I _cannot_ believe I didn't think of this.
>
>Thanks and I'll try and keep from 'tarding out like this again. :]
>
>Mike
>
> >-----Original Message-----
> >From: Will Swain [mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, August 14, 2001 5:50 AM
> >To: CF-Talk
> >Subject: RE: getting last 3 records...
> >
> >
> >How about:
> >
> ><cfquery name="getrecords" datasource="datasourcename" maxrows="3">
> >  SELECT *
> >  FROM tbl_whatever
> >  ORDER BY primarykey DESC;
> ></cfquery>
>
> >>> Hi,
> >>>
> >>> I need to get the last 3 (newest) records entered into my table.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to