Forum Moderators: open
This is the same order I have them entered in the enum field. Is there a way to sort on the underlying index? My understanding is that the data is actually stored as a numeric value.
ENUMvalues are sorted according to the order in which the enumeration members were listed in the column specification. (In other words,ENUMvalues are sorted according to their index numbers.) For example,'a'sorts before'b'forENUM('a', 'b'), but'b'sorts before'a'forENUM('b', 'a'). The empty string sorts before non-empty strings, andNULLvalues sort before all other enumeration values. To prevent unexpected results, specify theENUMlist in alphabetical order. You can also useGROUP BY CAST(col AS CHAR)orGROUP BY CONCAT(col)to make sure that the column is sorted lexically rather than by index number.
Resource:
[dev.mysql.com...]