Ok, Assuming I have following Table
=================
gr name
=================
A John
A Mary
A1 Jack
A1 Stephen
A Jess
A2 Neil
A2 Chris
what I would like to do is Random the order results with one rule, A1 should stick with A1 (in Random Order), and A2 should stick with A2 (in Random Order).
=================
gr name
=================
A Mary
A2 Chriss
A2 Neil
A Jess
A John
A1 Stephen
A1 Jack
The group name is Free, if you can comes up with a better group name, feel free to use it.
Thanks.
edit : For those who is curious, what I want to create is an Online Quiz. It will present question in Random Order to minimize the cheating. With one rule, a Question with Paragraph Text should stick with each other (in random order) so the students won't have to read the same paragraph multiple times.
The "paragraph grouped question" is in random order among other non-paragraph questions.
If you have a better idea of doing this, feel free to answer.
I have found this link : MySQL order by rand() grouped by day
I think my case is similar to his. It's just that he want to Pick One, and I want to pick ALL.
Another query I tried
SELECT * FROM `tbl` ORDER BY gr, rand()
it is able to randomize the name column, and the gr is stick to each other. I am left with one question, how to randomize the order of gr column while still make A1, A2, stick to each other
groupis not a legal MySQL column name.