Ahh, I see.  You want the rows to be randomized.

What DB are you using?

----- Original Message -----
From: Tom Forbes <[EMAIL PROTECTED]>
Date: Thursday, April 3, 2003 4:05 pm
Subject: Re: How can I "ORDER BY RANDOM" ?

> Thanks, I tried this, and it DOES return a list in a random order 
> every 
> time, BUT ... the record set is 7, and the query returns random 
> numbers of 
> results, from 1 to 7! I have the following line that I modified to 
> include 
> your code - could my GROUP parameter causing problems??
> 
> Tom
> 
> <cfoutput query="GetAllCompaniesWithMiniSites" 
> GROUP="ClassOfService" 
> startrow="#row#" maxrows="1">
> 
> 
> At 03:32 PM 4/3/03 -0700, you wrote:
> >Leave your query the same.
> >
> >Do something like:
> >
> ><cfset row = randRange(1, GetAllCompaniesWithMiniSites.recordCount)>
> >
> ><cfoutput query="GetAllCompaniesWithMiniSites" startrow="#row#" 
> maxrows="1">>      {do processing here}
> ></cfoutput>
> >
> >----- Original Message -----
> >From: Tom Forbes <[EMAIL PROTECTED]>
> >Date: Thursday, April 3, 2003 3:30 pm
> >Subject: Re: How can I "ORDER BY RANDOM" ?
> >
> > > I know, I stated in my question that I wanted to MODIFY the
> > > EXISTING query.
> > >
> > >
> > > At 02:26 PM 4/3/03 -0800, you wrote:
> > > >OK...but you should still remove that field from the ORDER BY
> > > clause :-)
> > > >Granted it may not always return records in a random order, but
> > > there is no
> > > >point in ordering by the CompanyName if you're after random 
> results.> > >
> > > >Bryan Stevenson B.Comm.
> > > >VP & Director of E-Commerce Development
> > > >Electric Edge Systems Group Inc.
> > > >t. 250.920.8830
> > > >e. [EMAIL PROTECTED]
> > > >
> > > >---------------------------------------------------------
> > > >Macromedia Associate Partner
> > > >www.macromedia.com
> > > >---------------------------------------------------------
> > > >Vancouver Island ColdFusion Users Group
> > > >Founder & Director
> > > >www.cfug-vancouverisland.com
> > > >----- Original Message -----
> > > >From: "Tom Forbes" <[EMAIL PROTECTED]>
> > > >To: "CF-Talk" <[EMAIL PROTECTED]>
> > > >Sent: Thursday, April 03, 2003 2:16 PM
> > > >Subject: Re: How can I "ORDER BY RANDOM" ?
> > > >
> > > >
> > > > > Bryan,
> > > > >
> > > > > I need to display the company names in a random order EACH
> > > TIME the query
> > > > > is run.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Tom
> > > > >
> > > > >
> > > > > At 02:12 PM 4/3/03 -0800, you wrote:
> > > > > >Remove the CompanyName field from the ORDER BY clause.  Then
> > > the results
> > > > > >will be ordered by ClassOfService only....unless I'm missing
> > > your point
> > > >;-)
> > > > > >
> > > > > >Bryan Stevenson B.Comm.
> > > > > >VP & Director of E-Commerce Development
> > > > > >Electric Edge Systems Group Inc.
> > > > > >t. 250.920.8830
> > > > > >e. [EMAIL PROTECTED]
> > > > > >
> > > > > >---------------------------------------------------------
> > > > > >Macromedia Associate Partner
> > > > > >www.macromedia.com
> > > > > >---------------------------------------------------------
> > > > > >Vancouver Island ColdFusion Users Group
> > > > > >Founder & Director
> > > > > >www.cfug-vancouverisland.com
> > > > > >----- Original Message -----
> > > > > >From: "Tom Forbes" <[EMAIL PROTECTED]>
> > > > > >To: "CF-Talk" <[EMAIL PROTECTED]>
> > > > > >Sent: Thursday, April 03, 2003 2:05 PM
> > > > > >Subject: How can I "ORDER BY RANDOM" ?
> > > > > >
> > > > > >
> > > > > > > Dear CF'ers:
> > > > > > >
> > > > > > > I have searched my CF books for a clue, but am unable to
> > > find an
> > > >example
> > > > > >of
> > > > > > > what I am trying to do.
> > > > > > >
> > > > > > > I need to modify the below query so that my results are
> > > still ordered
> > > >by
> > > > > > > "ClassOfService" (a number between 1 and 4) - BUT, the
> > > "CompanyName">needs
> > > > > > > to be displayed in a RANDOM ORDER each time the query is
> > > run, rather
> > > >than
> > > > > > > its current alphabetical order. This will give all
> > > companies that
> > > > > > > participate an even advantage of being selected rather
> > > than those that
> > > > > > > begin with the first letters of the alphabet.
> > > > > > >
> > > > > > > Can someone please point me in the right direction? I have
> > > studied the
> > > >CF
> > > > > > > RANDOM tag but can't figure out how to apply it.
> > > > > > >
> > > > > > > <CFQUERY NAME="GetAllCompaniesWithMiniSites"
> > > DATASOURCE="MedMallDs"> > > > DBTYPE="ODBC">
> > > > > > >
> > > > > > >      SELECT *
> > > > > > >
> > > > > > >          FROM CompanyTbl
> > > > > > >
> > > > > > >          WHERE CompanyWantsMiniSite = 'Yes' AND
> > > MakeMiniSitePublic =
> > > >'Yes'
> > > > > > >
> > > > > > >          ORDER BY CompanyTbl.ClassOfService,
> > > CompanyTbl.CompanyName> > > >
> > > > > > > </CFQUERY>
> > > > > > >
> > > > > > > Thanks very much!!
> > > > > > >
> > > > > > > Tom Forbes
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > 
> >***********************************************************************> > > > > > 
> >Tom Forbes,  Forbes Consulting, Inc.
> > > > > > > TEL: 407-772-3427       FAX: 407-772-3428
> > > > > > > Visit www.medmatrix.com for Medical Equipment Web Sites!
> > > > > > > E-Mail Subscription at www.medmatrix.com/mail_list.htm
> > > > > > >
> > > 
> >***********************************************************************> > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
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

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to