Hi Marc and Mike,
As mentioned, I'm using Access (not SQL Server) 2000. The rand() function
in the SQL statement does not seem to work. Any alternatives?
Blessings,
Graham
----- Original Message -----
From: "Marc Campeau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 31, 2002 12:26 PM
Subject: RE: [CFTALKTor] random selection from database
> > i am not sure about the order database, but i think it doesn't
> > work in MSSQL
> > since Rand function always return the same value in all rows in one
query.
>
> I didn't try it so oops, but to this and it will work:
>
> > <cfquery name="getPhoto" datasource="dsn">
> > SELECT TOP 1 items, rand(either a unique_ID column or NewID() ) as
> orderCol
> > FROM db table
> > ORDER BY orderCol #IIF(getTickCount() MOD 2, DE("ASC"), DE("DESC"))#
> > </cfquery>
>
> Just creating a newID will return the rows sequentially which isn't
random.
>
> Marc
>
> -
> You are subscribed to the CFUGToronto CFTALK ListSRV.
> This message has been posted by: "Marc Campeau" <[EMAIL PROTECTED]>
> To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
> Manager: Kevin Towes ([EMAIL PROTECTED])
http://www.CFUGToronto.org/
> This System has been donated by Infopreneur, Inc.
> (http://www.infopreneur.net)
>
-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "Graham Faulkner"
<[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)