This is sort of a silly overkill I suppose, but I had this same
dilemma some time ago, I had a table that held options for multiple
choice questions and I needed them ordered randomly within the select
query. A fellow (I forget his name, truly sorry) helped me out with
a tip I expanded a bit, as below, FWIW. I added the two sets, both
with arbitrary numbers in them, to try and get as random with every
loop output or reload as possible. His tip was to use an ascii char
(which obviously will only work if what you are selecting has a
fairly unique text value in at least one field, but I include this
here just for reference). This is 'mostly random most of the time'
which was better than the pathetic result I had prior, so I don't
complain --
<CFSET RANDNUM1 = "#RandRange(1,289)#">
<CFSET RANDNUM2 = "(#RANDNUM1# * #RandRange(6,3964)#)">
<CFQUERY >
select table.id, table.charfield, table.numfield
from table
where [whatever]
order by Rand(#RANDNUM2# * Ascii(Right(table.charfield,2)) * 3)
</CFQUERY>
PJ
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists