Ben Sinclair
Ben Sinclair

Reputation: 3986

Ordering non-english letters in MySQL

I have a client who just sent me the following in regards to order their letters. They are from Finland.

In our alphabet the letters å, ä and ö are at the very end of the alphabet. Therefore names starting with those should also be after the letter z, not under "a" or "o".

This is the first I've heard of this. Is there a way I could make these letters show at the end of a alphabetical list using MySQL?

Upvotes: 0

Views: 1200

Answers (3)

James Chong
James Chong

Reputation: 71

Best use ASCII coding/indexing as multilingual www.qfree.com.au can be any language display

Upvotes: 0

John Woo
John Woo

Reputation: 263683

That's probably the collation of that table is utf8_general_ci. Try this,

SELECT..
FROM..
WHERE..
ORDER BY text COLLATE utf8_bin

Upvotes: 4

tadman
tadman

Reputation: 211540

You need to pick a collation that fits your ordering and encoding requirements. A list of them can be fetched with:

SHOW COLLATION

You should be able to set the collation on your connection, and tables and associated data can also be set with defaults. Some statements also support specifying the collation for ordering purposes.

I remember utf8_swedish_ci being the default for a long time presumably because MySQL was created by a Finn while working in Sweden. Later that was changed to utf8_general_ci to be more neutral.

Upvotes: 1

Related Questions