Is there a performance advantage using LIMIT 3 rather than the maxrows
attribute of cfquery?

Will

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: 10 March 2008 16:45
To: CF-Newbie
Subject: Re: Querying more then one Record from db

Frank,

If you are MSSQL server, you can use TOP 3:

SELECT TOP 3
id, name
FROM
your_table
ORDER BY
date_created DESC

Or, in mySQL, you can use LIMIT 3

SELECT
id, name
FROM
your_table
ORDER BY
date_created DESC
LIMIT 3

Cheers,
Ben


On 3/10/08, Frank Velazquez <[EMAIL PROTECTED]> wrote:
>
> Hey guys, what's up? I was wondering how could I select the last 3 
> records (or more) that have been inserted into my Database, should I 
> use recordcount?
>
> I need that because on my site, in the home page I want to display 
> recently added stuff.
>
> Thank you!
>
> Frank V.
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3400
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to