Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accesing one query field among several 1

Status
Not open for further replies.

leadman

Programmer
Joined
Jun 11, 2001
Messages
177
Location
US
Im going to ry to word this so it makes sense :)

im running a query that checks the db table to see if data coming from a form is already in the table and grabs the id field from any matches. If no match (recordcount = 0) then the data gets input. If it is already there then i want to grab the id field - im doing this by saying &quot;if query.recordcount gt 0, then set id=query.id&quot;. this works if there was only one record returned (i only need one id). How can I grab one id if more than one is returned? can i say, for instance, <cfset billingID = #max(qGetBid.bID)#> instead of <cfset billingID = #qGetBid.bID#> so that i get the highest one returned? would this work?
 
Wouldn't it be easier to do it in the query itself?

<cfquery name=&quot;qGetBid&quot; maxrows=&quot;1&quot;>
select max(bID) from billingTable where etc...
</cfquery> - tleish
 
yes it would! Im learning :)
thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top