I have a table like this:
id | name
----------------
1 | àbbot
2 | about
3 | zorro
I want to select the first letters in a case-insensitive context, like this:
let
----------
a
z
But any of those, with any unicode collation, gives the same wrong result:
SELECT LOWER(SUBSTR(name,1,1)) AS let FROM t GROUP BY let
SELECT LOWER(SUBSTR(name,1,1)) AS let FROM t GROUP BY letter ORDER BY let ASC
SELECT * FROM
(SELECT LOWER(SUBSTR(name,1,1)) AS let FROM t ORDER BY let DESC) AS x
GROUP BY let ORDER BY let ASC
Wrong result:
let
----------
à
z
Is there a way to fix the ordering, without casting? (because I have to cover non-Latin languages too, such as Japanese).
Maybe I have an old version of MySQL… Can you test queries in your environment, please?
Thank you in advance!
nevermind, found a solution