How to sort results with german umlauts in a UTF8 MySQL Database

2005-07-25 Thread Nico Grubert

Hi there,

I have a MySQL 4.1 DB running including a database whose character set
is set to utf8.
In the database I have a table tblmembers with some records containing
german umlauts.
How do I sort results with german umlauts if the database character set
is set to utf8?

Using the SQL query

SELECT memberid, lastname
  FROM tblmembers
  ORDER BY lastname

I get the following result:

Makee
Maty
Mayer
März
Müller
Münze
Mebel
Meier

This sort order is wrong according to german sorting rules.

The right sorting order according to german sorting rules is:

Makee
März
Maty
Mayer
Mebel
Meier
Müller
Münze


How can I sort the results in my utf8 database according german sorting
rules?

Thanks in advance.

Kind regards,
Nico 
_
Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle 
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How to sort results with german umlauts in a UTF8 MySQL Database

2005-07-25 Thread Alec . Cawley
Nico Grubert [EMAIL PROTECTED] wrote on 22/07/2005 09:06:25:

 
 Hi there,
 
 I have a MySQL 4.1 DB running including a database whose character set
 is set to utf8.
 In the database I have a table tblmembers with some records containing
 german umlauts.
 How do I sort results with german umlauts if the database character set
 is set to utf8?

According to http://dev.mysql.com/doc/mysql/en/charset-unicode-sets.html 
you might achieve the effect you want by setting the collation to 
utf8_unicode_ci

Alec


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How to sort results with german umlauts in a UTF8 MySQL Database

2005-07-25 Thread Christian Wollmann

You could try:

SELECT memberid, lastname
  FROM tblmembers
  ORDER BY lastname COLLATE latin1_german2_ci ASC

It worked in my database. But I dont know, if my database is utf8.

By the way: Perhaps you could tell me how I can determine/change the encoding 
of the database?

Kind regards
Christian Wollmann

Am Freitag, 22. Juli 2005 10:06 schrieb Nico Grubert:
 Hi there,

 I have a MySQL 4.1 DB running including a database whose character set
 is set to utf8.
 In the database I have a table tblmembers with some records containing
 german umlauts.
 How do I sort results with german umlauts if the database character set
 is set to utf8?

 Using the SQL query

 SELECT memberid, lastname
   FROM tblmembers
   ORDER BY lastname

 I get the following result:

 Makee
 Maty
 Mayer
 März
 Müller
 Münze
 Mebel
 Meier

 This sort order is wrong according to german sorting rules.

 The right sorting order according to german sorting rules is:

 Makee
 März
 Maty
 Mayer
 Mebel
 Meier
 Müller
 Münze


 How can I sort the results in my utf8 database according german sorting
 rules?

 Thanks in advance.

 Kind regards,
 Nico
 _
 Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle
 Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How to sort results with german umlauts in a UTF8 MySQL Database

2005-07-25 Thread Eugene Kosov

Christian Wollmann wrote:

By the way: Perhaps you could tell me how I can determine/change the encoding 
of the database?


SHOW CREATE DATABASE db_name;

ALTER DATABASE db_name
[[DEFAULT] CHARACTER SET charset_name]
[[DEFAULT] COLLATE collation_name];

http://dev.mysql.com/doc/mysql/en/charset-database.html

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]