The following query:
SELECT DISTINCT ClassName FROM SiteTree ORDER BY ClassName
is returning things in no apparent order!
I get the same result whether I quote column/table names, or use DISTINCT or not, or add ASC or DESC.
I assumed the indexes might be broken, or something like this, so tried dropping and recreating.
Also tried REPAIR TABLE and CHECK TABLE.
The table collation is set to latin1_swedish_ci.
All the textual columns are set to use UTF-8 and collation is set to utf8_general_ci
What could be causing this?
Edit:
Sample data at pastie.
Results are direct from SQL query executed in MySQL client (tried 2 different client apps).
Eureka!
While it’s true that using a function would return the correct order, e.g:
It turns out that I was looking at an ENUM column (I’d forgotten, thought it was plain text),
and so MySQL was sorting according to the order of the items in the ENUM.
Thanks for the helpful suggestions however.
Here’s a reasonable solution, given the situation.