Guys,
this will only work if the IDs start at 1, and there are no missing IDs.
Also, the #s are unnecessary in your CFSET.
Have fun,
Lee.
Bjork.Net
----------------------------------------------------
[EMAIL PROTECTED] (Brian bouldernet) wrote:
x = total available records
<cfset RandomCount = #RandRange(1,x)#>
<cfquery>
SELECT * FROM TABLE WHERE ID = Random Count
</cfquery>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 05, 2000 4:49 PM
To: CF-Talk
Subject: Random Record
How could i select a random record from a table?
Like to set my query as
<cfquery datasource="mine" name="selectrandomrecord">
SELECT *
FROM Table
WHERE RecordID = ??????
<cfquery>
Anyone know how to do this?
thanks
kev
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message
to [EMAIL PROTECTED] with 'unsubscribe' in the body.