This content has been marked as final. Show 3 replies
I imagine there are better ways to do this. But assuming both tables have a unique ID, pull the ids into two lists: firstList, secondList. Within a loop, grab a random value from both lists on each iteration. You can use the RandRange and ListGetAt functions.
<!---- get a random list position --->
<cfset firstPos = randRange(1, listLen(firstList))>
<!---- get the ID value at the position --->
<cfset firstID = listGetAt( firstList, firstPos )>
Once you have both ID's do your UPDATE. Then use ListDeleteAt to remove the used ID's from the lists. Keep looping until the lists are empty.
I can think of a more elegant ways to achieve this with MS SQL. But I do not know what database you are using or if this is more than a one time task.
> Make sense?