>> <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.

to Marc, nope its not sequentially.  NewID() in fact doesn't act like its
name sound like just creating a new id in a table/query, however it is a
build in function in MSSQL 2000 to create an unique value, and it's random.
try it out in SQL2000 u will see =)

to Graham, i think Dan's idea will work, probably it's the easiest solution,
or try this (although it's not a prefect solution):
        SELECT ((Rnd() * 100000) mod Any_Integer_Column) as OrderCol, * FROM
Your_TABLE ORDER BY OrderCol


rgds,

=============================
Mike Lau
Web Developer

[EMAIL PROTECTED]
User In Mind Creative Group Inc.

http://www.userinmind.com
Toll Free: 1-866-294-6644
T: (416) 490-7556
F: (416) 490-6889
=============================

>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: "Mike Lau" <[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)

Reply via email to