Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 SELECT QUERY FOR RANDOMLY ACCESSING DATA

Author  Topic 

amit_bhardwaj5
Starting Member

1 Post

Posted - 2005-06-08 : 02:45:21
Hi All,

I have a problem:

I have created an online exam in web and using ms access as database.
Now I want that whenever a user login he will get any randomly generated 20 question out of 100 question stored in database.
for that currently I m using the following query:
"SELECT TOP 20 QID FROM QUESTIONDATA ORDER BY QUESTIONS";

It works fine to retrieve 20 records from database randomly but the problem is that it retrieves same 20 records each and every time, rest the records remain untouched.

So if any one knows any query for retrieving random different records from database every time then please help me.

Thanks in advance
Take care
Bye
Amit

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-08 : 02:57:34
SELECT TOP 20 QID FROM QUESTIONDATA ORDER BY Rnd(QID)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -