You can use the ORDER BY
to sort as many columns as possible.
SELECT id, name, activity FROM userList ORDER BY Activity, ID
I would suggest reading the MySQL ORDER BY
docs. You can sort the data in ASC
or DESC
order: MySQL: ORDER optimization
Taryn source share