SELECT TOP 1
    field1,
    field2,
    ...
FROM
    table
WHERE
    public = 1
ORDER BY
    newID()

----- Original Message -----
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 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.
>
> Thanks in advance.
>
>
> Dustin Snell
> Network Automation, Inc
> www.networkautomation.com
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to