今天遇到要中文排序的问题。直接用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();
今天遇到要中文排序的问题。直接用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();