RE: Retrieve a random record from a database

2004-07-21 Thread Tim Blair
> Is there a MySQL equivalent to this newID() functionality? With MySQL you can pull out one random row by using a combination of ORDER BY RAND() and LIMIT, e.g.: SELECT * FROM myTable ORDER BY RAND() LIMIT 1 Tim. -- --- Badpen Tech - CF and w

RE: Retrieve a random record from a database

2004-07-21 Thread James Smith
Is there a MySQL equivalent to this newID() functionality? -- Jay > -Original Message- > From: Charlie Griefer [mailto:[EMAIL PROTECTED] > Sent: 20 July 2004 22:42 > To: CF-Talk > Subject: Re: Retrieve a random record from a database > > as a rule, you should

Re: Retrieve a random record from a database

2004-07-20 Thread Jeff Langevin
From: "Dustin Snell [Network Automation, Inc]" > <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Tuesday, July 20, 2004 2:21 PM > Subject: Retrieve a random record from a database > > > We have a database with a bunch of customer testim

Re: Retrieve a random record from a database

2004-07-20 Thread Charlie Griefer
r specific...so your app's "portability" suffers a bit) - Original Message - From: "Jeff Langevin" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, July 20, 2004 2:34 PM Subject: Re: Retrieve a random record from a d

Re: Retrieve a random record from a database

2004-07-20 Thread JediHomer
You could do something like SELECT TOP 1 * FROM Testiments WHERE Public = 1 ORDER BY NewID() HTH - Original Message - From: Dustin Snell [Network Automation, Inc] <[EMAIL PROTECTED]> Date: Tue, 20 Jul 2004 14:21:44 -0700 Subject: Retrieve a random record from a database To: C

Re: Retrieve a random record from a database

2004-07-20 Thread Charlie Griefer
21 PM Subject: Retrieve a random record from a database > We have a database with a bunch of customer testimonials in it. Records can > be added to it at anytime. Some are marked public and some or not. Does > anyone know how I could pull a single record randomly from the database >

Re: Retrieve a random record from a database

2004-07-20 Thread Jeff Langevin
You could query for all public records and then use randRange(1,myquery.recordcount).  That'll give you a random row.  Then use the primary key to do whatever you need form there.  HTH. --Jeff Dustin Snell [Network Automation, Inc] wrote: > We have a database with a bunch of customer testimoni

Retrieve a random record from a database

2004-07-20 Thread Dustin Snell [Network Automation, Inc]
We have a database with a bunch of customer testimonials in it. Records can be added to it at anytime. Some are marked public and some or not. Does anyone know how I could pull a single record randomly from the database using MSSQL2000 and CF6.1 for display on the website - but only out of the reco