<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/

Reply via email to