Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 10 questions in data base and i want to retrive the data database randomly.
the columns are que,a,b,c,d,correct answer.total 6 columns

these are my columns in which questions as well as options and answers are fetched.
now i want to retrive it randomly and display it in design part.so what query i need to write.....
Posted
Updated 21-Nov-11 20:07pm

Maybe, simple use query like that:

SQL
SELECT * FROM table ORDER BY RAND() LIMIT 1
 
Share this answer
 
 
Share this answer
 
Try this query
SQL
select top 20 percent * from tableName order by newid()


tableName = your table name
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900