I have an enumeration: ENUM( 'alpha', 'beta', 'gamma', 'delta', 'omega' )
If I sort my table by this column I get them in the correct order defined above.
However, I can't find a way to select a subset of these, e.g. everything before delta. Using WHERE status < 'delta'
only returns alpha and beta, not gamma. It seems MySQL uses a string comparison, not enum index comparison.
I could use the index numbers - i.e. WHERE status < 4
- but it's a bit of a code smell (magic numbers) and may break if I insert new values into the enumeration.