RE: Randomizing Query Results
What database does this work on? I should have specified what database I am using. I am developing for Oracle 8i. Thanks, Dave -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED]] Sent: Monday, October 07, 2002 10:42 AM To: CF-Talk Subject: Re: Randomizing Query Results David Jones wrote: What is the best way to randomize the results of a CF query? Offload it to the database: SELECT * FROMtable ORDER BYRandom() Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: Randomizing Query Results
I want to randomize what ever results return from the query. Could be 1,2,,,500 and so on. Thanks, Dave -Original Message- From: Mike Townend [mailto:[EMAIL PROTECTED]] Sent: Monday, October 07, 2002 9:34 AM To: CF-Talk Subject: RE: Randomizing Query Results In what way? Do you just want to display a random record from a set... Or a load of records just in a random order? -Original Message- From: David Jones [mailto:[EMAIL PROTECTED]] Sent: Monday, October 7, 2002 14:24 To: CF-Talk Subject: Randomizing Query Results What is the best way to randomize the results of a CF query? Thanks, Dave ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
RE: Randomizing Query Results
oracle uses the DBMS_RANDOM package to create random numbers. Kore Peterson Database Development Specialist SEH - Minneapolis 612.758.6739 David Jones djones@applie To: CF-Talk [EMAIL PROTECTED] dx.com cc: Subject: RE: Randomizing Query Results 10/08/2002 08:54 AM Please respond to cf-talk What database does this work on? I should have specified what database I am using. I am developing for Oracle 8i. Thanks, Dave -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED]] Sent: Monday, October 07, 2002 10:42 AM To: CF-Talk Subject: Re: Randomizing Query Results David Jones wrote: What is the best way to randomize the results of a CF query? Offload it to the database: SELECT* FROM table ORDER BYRandom() Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Re: Randomizing Query Results
David Jones wrote: What database does this work on? At least on PostgreSQL. I should have specified what database I am using. I am developing for Oracle 8i. I presume you mean it doesn't work ;) You could try; SELECT * FROM ( SELECT *, Random() AS sortfield FROMtable ) ORDER BY sortfield Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
Randomizing Query Results
What is the best way to randomize the results of a CF query? Thanks, Dave ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
RE: Randomizing Query Results
In what way? Do you just want to display a random record from a set... Or a load of records just in a random order? -Original Message- From: David Jones [mailto:[EMAIL PROTECTED]] Sent: Monday, October 7, 2002 14:24 To: CF-Talk Subject: Randomizing Query Results What is the best way to randomize the results of a CF query? Thanks, Dave ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Re: Randomizing Query Results
Your query results range between 1 and Total Record Count right? So you could do something like cfset r=randRange(1,QueryName.recordCount) cfoutput #QueryName.columnName[r]# /cfouput The above is what i guessed from your question. Joe Eugene Certified Advanced ColdFusion Developer - Original Message - From: David Jones [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, October 07, 2002 9:23 AM Subject: Randomizing Query Results What is the best way to randomize the results of a CF query? Thanks, Dave ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
Re: Randomizing Query Results
David Jones wrote: What is the best way to randomize the results of a CF query? Offload it to the database: SELECT * FROMtable ORDER BYRandom() Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com