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: CF-Talk <[EMAIL PROTECTED]>

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
records where public=1? I am just not sure how to structure the query to do
this.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to