CREATE TABLE groups( groupno INT(11) DEFAULT NULL, eventno INT(11) DEFAULT NULL ); INSERT INTO groups VALUES (1, 4), (2, 8), (4, 3), (1, 5), (3, 1);
Output custom ordered records:
SELECT groupno, eventno FROM groups ORDER BY FIELD(groupno, 3,2,1,4); +---------+---------+ | groupno | eventno | +---------+---------+ | 3 | 1 | | 2 | 8 | | 1 | 4 | | 1 | 5 | | 4 | 3 |
0 comments:
Post a Comment