use*_*652 5 mysql sorting non-english
我正在尝试对包含希腊字符的表进行排序.每次单击表格的标题时,表格的相应英文版本都会正好排序(两者ASC和DESC每个).
我在希腊论坛上搜索过,建议的唯一解决方案是使用ORDER BY BINARY.事实上,很多人说使用二进制顺序解决了他们的问题.不幸的是,它不属于我的情况.我知道同样的问题存在于像德语这样的语言,其中使用变音符号会破坏顺序,并且通常在具有特殊字符的语言中.如果有人知道如何克服这个问题,我将不胜感激.
根据forums.mysql.com 上的一个帖子,在 MySQL 6.0 中,如果表的字符集设置为 ,则可以对希腊名称进行排序utf8_general_ci。
create table t (s1 char(1) character set utf8 collate utf8_general_ci); \ninsert into t values (\'\xce\x91\'),(\'\xce\x92\'),(\'\xce\x93\'),(\'\xce\x94\'),(\'\xce\x95\'),(\'\xce\x96\');\nselect * from t order by s1;\nRun Code Online (Sandbox Code Playgroud)\n\n上面应该返回
\n\n+----+ \n| s1 | \n+----+ \n| \xce\x91 | \n| \xce\x92 | \n| \xce\x93 | \n| \xce\x94 | \n| \xce\x95 | \n| \xce\x96 |\n+----+ \nRun Code Online (Sandbox Code Playgroud)\n