mysql 根据汉字排序

/**
 * 获取企业
 */
public function getCompany() {
    $company = M('company');
    $company_list = $company->where(['type'=>1])->field('id,name')->order('CONVERT(name USING gbk)')->select();
    // $sql = 'select id,name from tf_company where type=1 ORDER BY CONVERT(name USING gbk)';
    // $company_list = M()->query($sql);
    $this->json->S($company_list);
}
posted @ 2020-10-17 09:59  TBHacker  阅读(349)  评论(0编辑  收藏  举报