mysql中文排序,用到的是:
SELECT id id, billId billId, namespec nameSpec, unit unit, amount amount, price price, remark remark, alias alias, materialType materialType FROM project_materials WHERE billId = 'TLD20151028162729584' ORDER BY CONVERT(nameSpec USING gbk) LIMIT 0, 20
ORDER BY CONVERT(nameSpec USING gbk) 是重点。
还有一句强制转换:如下:
SELECT id id, billId billId, namespec nameSpec, unit unit, amount amount, price price, remark remark, alias alias, materialType materialType FROM project_materials WHERE billId = 'TLD20151028162729584' ORDER BY CONVERT(nameSpec USING gbk) COLLATE gbk_chinese_ci LIMIT 0, 20