In my MySQL database, I have a table with different questions in different categories.
I would like to write a SQL statement that returns 3 RANDOM questions of EACH
In addition to the other answer, this is also another way to do it.
SELECT r.* FROM random r WHERE ( SELECT COUNT(*) FROM random r1 WHERE r.category = r1.category AND r.id < r1.id ) <= 2 ORDER BY r.category ASC, RAND()