Could you not use something like

Query1
SELECT yourIDField
FROM yourTableName

Query2
SELECT yourIDField
FROM yourTableName
WHERE yourIDField = #randRange(1,Query1.recordCount)#

If the list of items is fairly stable you could drop Query1 and change the
last line of query2 to
WHERE yourIDField = #randRange(1,600)#

--
James Smith
[EMAIL PROTECTED]

----- Original Message -----
From: "Chad" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, December 18, 2002 5:08 PM
Subject: Random SQL statement


> I have a table with a Unique ID field and I would like to do a random
> select on the table UID.
>
> Basically I want to send the user to a page that displays that random
> record.
>
> Does SQL have a random function?  I cant find anything in my books.
> SELECT rand(ID)
> FROM table
>
> Or should I select all records from the table and use CF to pick a
> random record from the dataset?
>
> Thanks,
> Chad
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to