I have a table of 600 or so products that I store as a cached query..
then generate a random number from one to the recordcount in CF and use it
as the rowstart and rowend.    Works like a charm unless you intend to have
it update the data in real time..      performance gains are seen in as
little as caching the query for 5 minutes :).

-Ezine

-----Original Message-----
From: Dowdell, Jason G [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 12:15 PM
To: CF-Talk
Subject: RE: Random SQL statement


This link goes into this in depth.

http://www.aspalliance.com/stevesmith/articles/randomselect.asp

~Jason

-----Original Message-----
From: Chad [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 12:09 PM
To: CF-Talk
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
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to