I have a table that looks like this:
There are 100 questions.
Table Structure for "Questions Table":
title:
answerA:
answerB:
answerC:
answerD:
category:
difficulty:
Each question can have one 1 of 5 categories("1,2,3,4 or 5") and 1 out of 3 difficulty levels("easy, medium OR hard").
Currently I am sorting them by category and randomly such as this:
"SELECT * FROM Questions order by category, rand()";
So now the questions are sorted by category and randomized.
I would like that the results come ALSO with different difficulty levels for each category.
So something like this:
question 1 , category 1, difficulty easy
question 3 , category 1, difficulty medium
question 4 , category 1, difficulty hard
question 2 , category 1, difficulty easy
question 5 , category 2, difficulty easy
question 6 , category 2, difficulty medium
question 7 , category 2, difficulty hard
question 2 , category 2, difficulty easy
question 8 , category 3, difficulty easy
question 10, category 3, difficulty medium
question 9 , category 3, difficulty hard
question 0 , category 3, difficulty easy
and so on.
How would I replicate the above? It seems that I need 2 criteria in my sorting and the difficulty criteria needs to change each time a question is printed for a new category.
Most of the Google results I found have to do with categorizing by 2 fields but with the same order.