I have two tables, question_table and answer_table. i want to be able to select a certain number of questions in a random order and have the answers that relate to the selected questions also display. IE:
question_Table:
ID: Question_Text
1 Who are you?

Answer_Table:
ID: Question_ID: Question_Answer
1 1 Me.
2 1 You.
3 1 Somone.

I have this right now, but everything is completely random and out of order:

SELECT b.ID, b.Question_Text, a.question_answer FROM Question_Table b
	right JOIN 
	Answer_table a
	ON b.ID = a.Question_ID
	Order by NewID()

I need the questions in random order, and but the answer also need to be random in the same order as the questions (If that makes any sense. IE:
question 3
answer 2 for question3
answer 1 for question3
answer 3 for question3
answer 4 for question3

question 1
answer 1 for question1
answer 4 for question1
answer 2 for question1
answer 3 for question1

Hopefully that makes more sense. Any help would be greatly appreciated. Thank you in advance. Also, sorry if this is a duplicate, please delete if it is.

Try ORDER BY RAND() instead of NewID()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.