Specify a maxrows attribute in your CFQUERY call and sort by date
descending:
<cfquery name="myName" datasource="myDSN" maxrows=5 dbtype="ODBC">
SELECT ....
FROM ..
WHERE ..
ORDER BY submittedDateTime DESC
</cfquery>
Tom Nunamaker
Jeffrey Cohen wrote:
>
> Greetings...
>
> What is the best method for reading ONLY the last five records in a
> database for display?
>
> I have a client that adds articles daily to a news database, and then
> displays them on a news page. There are hundreds of articles, and on his
> home page he just wants to display the 5 most recent. (which would be
> the last five in the database, I presume....)
>
> Suggetstions???
>
> and thanks as always for your help in advance...
>
> Jeffrey Cohen
> ImageWorks
>
> ------------------------------------------------------------------------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.