[thelist] Coldfusion/SQL:queries:maxrows

Raymond Camden jedimaster at macromedia.com
Mon Sep 17 10:21:04 CDT 2001


> 
> > I'm getting an error - is "TOP" supported in MySQL?
> 
> I'm not sure, but can't you use LIMIT instead?
> 
> e.g. SELECT * FROM table WHERE this='that' ORDER BY this LIMIT 1
> 
> would return 1st record.
> 
> Simon
> 

In general, this all boils down to what your DBMS supports. Don't bother
looking at the CF docs for this, consult the docs for your DBMS.

<tip type="Generic Web Application" Author="Raymond Camden">
You should ALWAYS try to do as much logic in your DBMS as possible. For
example, instead of doing a select * and having CF parse out the records
where foo > 1, or some other condition, put the condition in your SQL
statement.

Check the docs for your DBMS. You will be surprised at the kind of
logical parsing you can do on data.

</tip>

-Ray





More information about the thelist mailing list