[thelist] Coldfusion/SQL:queries:maxrows

Raymond Camden jedimaster at macromedia.com
Mon Sep 17 07:47:36 CDT 2001

You can use TOP, if your DBMS supports it, to return the first X rows.

It works like so...

SELECT TOP 10 	Name, Foo, Goo
FROM			tblBlahBlah
WHERE			Name LIKE '%Newman%' OR Name LIKE '%Aboot%'

I would assume that this would be quicker than using MAXROWS.

Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email    : jedimaster at macromedia.com
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: thelist-admin at lists.evolt.org 
> [mailto:thelist-admin at lists.evolt.org] On Behalf Of Bimal Shah
> Sent: Monday, September 17, 2001 7:37 AM
> To: thelist at lists.evolt.org
> Subject: [thelist] Coldfusion/SQL:queries:maxrows
> Hi,
> Is there any advantage to using SQL to return
> a set number of results compared to using the
> maxrows parameter of a cf query?
> I am trying to query a table, only wishing to
> return the first match e.g
> <cfquery name="getLastDate" maxrows="1"...
> 	thedate
> 	testTable
> 	thedate<#today#
> 	thedate DESC
> How would one do the above in pure SQL (without
> using maxrows?
> Bimal
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to: 
http://lists.evolt.org Workers of the Web, evolt ! 

More information about the thelist mailing list