Re: random records no duplicates

2012-03-29 Thread Akos Fortagh
Massive thanks to everybody who helped especially to Bobby for an exact example, all works great. thanks again ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=hou

RE: random records no duplicates

2012-03-29 Thread andy matthews
Agreed. Simple to store a list of already asked questions in the session scope. andy -Original Message- From: .jonah [mailto:jonah@creori.com] Sent: Thursday, March 29, 2012 4:12 AM To: cf-talk Subject: Re: random records no duplicates Another way is to leave the already asked

RE: random records no duplicates

2012-03-29 Thread Bobby Hartsfield
There are more efficient ways of getting a single random record from the database. You are grabbing them all every time when you only need 1. SQL Server: SElECT TOP 1 q.questionid, q.questiontext FROM questions q ORDER BY NEWID() MySQL SELECT q.questionid, q.questiontext FROM questions q ORDER

Re: random records no duplicates

2012-03-29 Thread .jonah
Another way is to leave the already asked questions out of your new query each time: SELECT questions.questionid, questions.questiontext FROM questions WHERE questions.questionid NOT IN (#listOfPreviouslyAskedQuestions#) #questiontext# On 3/29/12 1:58 AM, .jonah wrote: > E

Re: random records no duplicates

2012-03-29 Thread .jonah
Either keep a list of questions already asked and query again if it tries to give you one you've had before or keep a a copy of the query for each user and remove the row after you ask each question. On 3/29/12 1:21 AM, Akos Fortagh wrote: > hi there, wondering if someone might be able to help