in reply to Re^2: mysql sorting
in thread mysql sorting

GROUP BY comes in very handy here, actually. (with MySQL's handy GROUP_CONCAT() function, versions 4.1 and up):
SELECT Group, GROUP_CONCAT(SomeData ORDER BY SomeData SEPARATOR ',') FROM table GROUP BY `Group`
In the OP's example, this would result in the following data that would be trivial to loop through and split on the separator chosen in your SQL:
green 3,9 orange 8 purple 4 red 1,5,6,7 yellow 2
-- Brian