Select random and unique records

Results 1 to 2 of 2

Thread: Select random and unique records

  1. #1
    Join Date
    Dec 1969

    Default Select random and unique records

    I have a database with around 150 different questions and corresponding answers (used in a competition). The trick is to present the user with a randomly selected question 10 times and each time a unique one.<BR><BR>I am selecting ten random record id&#039s by first select * form the db and hence randomise 10 unique numbers within the rs.recordcount as outerbound. But I&#039m curious if there exist a way of randomly select a record without first selecting the hole db into the rs - can be quite large and unessesary. Something like @@random ??

  2. #2
    Larry Boggs Guest

    Default RE: Select random and unique records

    Frederik,<BR>How are you selecting the 10 random records? I&#039ve been trying to figure this out for sometime now!<BR>I&#039m trying to retrieve "n" number of random & unique questions from a table of "n" number of questions. I&#039d really appreciate seeing your code and how you are accomplishing this!<BR><BR>The following SELECT statement pulls all records where topic is IN topiclist. <BR><BR>SQLCommand = "SELECT Question.Index,MatchIndex,QType,QuestionText," & _<BR> "Response,ResponseText FROM question LEFT OUTER JOIN answer " & _<BR> "ON question.index=answer.index WHERE topic " & _<BR> "IN (" & topicList & ") ORDER BY Question.Index,Response"<BR><BR>Thanks alot,<BR>Larry Boggs<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts