This content has been marked as final. Show 8 replies
ColdFusion does not need to support First() it does not parse SQL, it
just bundles it up and sends it to the database. If your database
understands first() then just send it the SQL code you need.
How about using TOP 1?
How about setting MaxRows equal to 1?
Top 1 would work if query of query supported it, but it doesn't - I get errors. Also, I can't include the first() function in the sql because the query needs to be a query of queries. I desperately need the FIRST() function to work in C.F.
How about just using #QueryName.ColumnName# outside of a <cfoutput query=""> or <cfloop query=""> loop. It will always return the first row in your query.
<cfset Latitude = passedzip.Latitude>
<cfset Longitude = passedzip.Longitude>
How about just using #QueryName.ColumnName# outside of a <cfoutput
query=""> or <cfloop query=""> loop. It will always return the first
row in your query.
Or more properly... #queryName.ColumnName# which is what the above is
a short cut to though this allows one to get the second row if they
desire, ex. #queryName.ColumnName#. And of course if you replace the
integer in the row designation with a variable containing an integer,
then all kinds of fun things can be done.
I actually got what I needed using a couple of different queries. Thanks to everybody who responded!
i know this has been answered, but i would suggest putting as much of this on the database server as possible. use subqueries...id never suggest querying a query in coldfusion like that. it is handy, and a super shortcut..but will never really be that beneficial to you in the long run...
Thanks, fluid. I actually was able to do away with the query of queries and let the SQL do most of the work, as you mentioned. It is actually working quite well now - what a relief!