I am not sure why you are doing the second query... Why make the
*randomization* more complicated than it has to be???
Simplify:
!--- GET 2ND VALUE TO BE PASSED TO RANDRANGE ---
CFQUERY name=get_vids_a datasource=#datasource# maxrows=1
select
vidwee_id
from
vidweek
/CFQUERY
How very inefficient. How about something like this:
cfquery name=get_vid_ids datasource=#datasource#
SELECT vidwee_id
FROM vidweek
/cfquery
cfset idList=valueList(get_vid_ids.vidwee_id)
cfset idPosition=randRange(1,listLen(idList),SHA1PRNG)
cfset VAL_ID=listGetAt(idList,idPosition)
CFQUERY
You could query the table and get a list of the available IDs.
Generate a random number between 1 and listlen() and then using
ListGetAt() you can get that random ID and then query the DB again to
pull back that record.
On 8/23/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
All,
I'm doing a
Subject: RE: CFQUERY of non-swequential primary key ids
How very inefficient. How about something like this:
cfquery name=get_vid_ids datasource=#datasource# SELECT vidwee_id FROM
vidweek /cfquery
cfset idList=valueList(get_vid_ids.vidwee_id)
cfset idPosition=randRange(1,listLen(idList
4 matches
Mail list logo