Mark If that retirns "0", wont that error?
recordsets start from 1, not 0 Regards Steve Onnis Domain Concept Designs +61 422 337 685 +61 3 9444 7504 http://www.domainconceptdesigns.com <http://www.domainconceptdesigns.com> ("If you think it can't be done, you haven't asked me!") - Steve Onnis -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Mark Stanton Sent: Monday, February 10, 2003 7:17 PM To: CFAussie Mailing List Subject: [cfaussie] RE: Random Record in a query <cfquery datasource="#request.ds#" name="myQuery"> SELECT myCol FROM myTable </cfquery> <cfset min = 0> <cfset max = myQuery.recordcount - 1> <cfset randRecord = randrange(min,max)> <cfoutput> #myQuery.myCol[randRecord]# </cfoutput> This is assuming you need the whole query for something and for some reason also need to pull a random record. If you *just* need the one record then there are probably better ways that the clever SQL people can help you with. Cheers Mark ______________ Mark Stanton Web Production Gruden Pty Ltd Tel: 9956 6388 Mob: 0410 458 201 Fax: 9956 8433 www.gruden.com --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
