Display Random Records

Results 1 to 2 of 2

Thread: Display Random Records

  1. #1
    Join Date
    Dec 1969

    Default Display Random Records

    HI There..<BR> Suppose i have a table which has some 50 questions : <BR>Now, if i have to fetch just 10 questions , IN ANY RANDOM ORDER (this is important), within this recordset , how do i do that... This is basically when the user refreshes the page, he/she should be able see a NEW set of questions every time<BR> Seems simple, isnt it ? i know. that the reason why i have posted it here... expecting a prompt answer<BR><BR>Nikhil

  2. #2
    Scott S Guest

    Default RE: Display Random Records

    What database platform? If it&#039s MS SQL Server or something similar (Oracle,DB2, Sybase etc..) I&#039d use a stored procedure to do it. <BR><BR>I&#039d create a temporary table in the stored procedure, randomly grab a record from my table of questions. When I got each random record I&#039d load it into the temporary table, when I had the amount i wanted, just SELECT * FROM #YOURTEMPTABLE and then drop the table. Simple enough. If your using Access, or a database that doesnt have stored procedures then you need to hit the database ten times I think.<BR><BR>Hope That Helps<BR><BR>Scott S

Posting Permissions

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