i have a table in my sql mcq-quiz
id question category
1 q1 c1
2 q2 c1
3 q3 c1
4 q4 c2
5 q5 c2
6 q6 c3
7 q7 c3
8 q8 c4
9 q9 c4
10 q10 c5
i want single record from given category ... but record should be random..
i have tried the following query
SELECT id, question, category FROM `mcq_quiz` where category in(c1,c2,c3,c4,c5) group by category
it is doing good job ... but retrieves same records every time but i want new and random record every time.. ( i have 2000 records in my original table)
i also have tried rand() function, it retrieves the same records every time but change the sequesnce, but i need random record everytime... plz help me to sortout this ... thanks in advanced
Aucun commentaire:
Enregistrer un commentaire