Is there a way in SQL (MySQL) to do a “round robin” ORDER BY on a particular field?
问题 Is there a way in SQL (MySQL) to do a "round robin" ORDER BY on a particular field? As an example, I would like to take a table such as this one: +-------+------+ | group | name | +-------+------+ | 1 | A | | 1 | B | | 1 | C | | 2 | D | | 2 | E | | 2 | F | | 3 | G | | 3 | H | | 3 | I | +-------+------+ And run a query that produces results in this order: +-------+------+ | group | name | +-------+------+ | 1 | A | | 2 | D | | 3 | G | | 1 | B | | 2 | E | | 3 | H | | 1 | C | | 2 | F | | 3 | I |