-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

SELECT  TOP 5 field
FROM            tablename
ORDER BY        datefield

_____________________________________

Chris Chambers

ICQ: 40311211
AIM: CTC HOME

VOX: 757-896-6393
FAX: 757-896-0774 
_____________________________________

- -----Original Message-----
From: Dave Notik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 18, 2000 10:34 PM
To: ColdFusion List
Subject: HELP: Retrieving 5 most recent records by date...
Importance: High


All:

I've done this many times in the past, but am now arguing the most
efficient
way to handle querying a database and retrieving the 5 (or however
many)
most recent records, as defined by date.

E.g. say I have a database in which I insert articles.  I have a
DateEntered
field which has a smalldatetime datatype.  I want to list the most
recent
first, second most recent, third most recent, etc...

Is there an "efficient" way of doing this or do I have to select all,
order
by the DateEntered field, loop over the results, etc?  Any help or
suggestions is appreciated as to what is the best method for handling
this
case.

- -Dave

- ----------------------------------------------------------------------
- --------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_tal
k or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOP0fUkejih2dfV0dEQJdzwCgsFDEtITgjE6/6wObVIha5T8W2wAAoIkY
mVzg5F/mFV1TzQv2ix/ZIiMf
=yFeJ
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
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.

Reply via email to