1-21 3,985 views
转自:http://hi.baidu.com/treejames/item/93fecd988a9df631336eeb0f 特此感谢
在处理使用Mysql时,数据表采用utf8字符集,使用中发现中文不能直接按照拼音排序
如果数据表tbl的某字段name的字符编码是latin1_swedish_ci
select * from `tbl` order by birary(name) asc ;
如果数据表tbl的某字段name的字符编码是utf8_general_ci
SELECT name FROM `tbl` WHERE 1 ORDER BY CONVERT( name USING gbk ) COLLATE gbk_chinese_ci ASC
===================
$orderby=”convert(`group` USING gbk) COLLATE gbk_chinese_ci,displayorder,navid”