Order by ASC returning weird results
I have the following query :
SELECT
x.id,x.title
FROM `x`
WHERE `x`.status = 'validated'
ORDER BY `x`.title ASC
Results :
3042 Cinéastes en herbe Télé-Québec
1681 Danse contemporaine
2725 Dessins, peinture et illustrations.
2448 Les petits mots de Paolo
641 Ma tente à lire et les Mosaïques dans la rue
3215 Performance & Visites commentées
2186 Se partager l’espace : Yann Pocreau
2364 Souper communautaire
1223 100 ans
199 100% couleurs
2794 125 ans de tourisme à Laval
2306 À court de souffle!
1517 Abracadabra Sonia
2477 Atelier ouvert
335 Au bout du fil
2362 Au coeur de notre mémoire
2489 Bientôt 100 ans!
2275 Café historique
1838 Rencontre avec
Am i missing something ? Why the title is not ordered correctly ?
For info :
Collation : utf8_general_ci
Character set : utf-8
Solution : 开发者_StackOverflowa hidden space was in the results --> used the trim function
I would check the first few rows to see if there is a hidden character at the front of the title.
SELECT
ASCII(SUBSTRING(x.title, 1, 1))
FROM
x
WHERE
x.id IN (3042, 1681)
Maybe you are not using the collation you want to. Depending on the collation of your database, strings get ordered differently.
精彩评论