现在的位置: 首页 > 综合 > 正文

在mysql数据库中中文排序

2017年10月19日 ⁄ 综合 ⁄ 共 227字 ⁄ 字号 评论关闭

今天遇到要中文排序的问题。直接用order by name 发现不行。查找资料原来是编码问题,转成gb2312即可。

select name from test1 order by convert(name using gb2312) asc;

在thinkphp 中写法为:

$Customer->distinct(true)->field("customer_name")->order("convert(customer_name using gb2312) ")->select();

抱歉!评论已关闭.