SQL查询中文自动按照拼音首字母排序

2013-6-6 liyangweb.com 李杨 MySQL

如果数据表team的某字段name的字符编码是utf8_general_ci;
SELECT * FROM `team` WHERE 1 ORDER BY CONVERT( name USING gbk ) COLLATE gbk_chinese_ci ASC

如果数据表team的某字段name的字符编码是latin1_swedish_ci;
SELECT * FROM `team` WHERE 1 ORDER BY BIRARY(name) ASC

标签: 中文排序SQL

发表评论:

Powered by emlog 冀ICP备13011830号-1