I have designed a quiz scenario using MySQL database as my backend.
I have a total of 20
questions and I would want to display them in random order from the
The order by
clausule needs column names or relative positions , not values or values. So. Try to add the RAND to the select and order by it.
Try this:
SELECT *, RAND() as ordering
FROM mst_que
ORDER by ordering;
If the table contains duplicate records, use SELECT DISTINCT
to filter them out.
SELECT DISTINCT *
FROM mst_que
ORDER BY RAND()