Because the database may be set coding table format, with different coding formats, the Chinese are different sort, the following were introduced under the common encoding sorting method.
1, if the character code of a field data table is utf8_general_ci, sort wording:
The ORDER BY the CONVERT (. Table Field Name Alias GBK the USING) the COLLATE gbk_chinese_ci the ASC ;
example
SELECT * FROM mg_clinic mc ORDER BY CONVERT(mc.`CLNAME` USING gbk) COLLATE gbk_chinese_ci ASC;
2, if the character code of a field data table is latin1_swedish_ci, sort wording:
the Order by birary (table alias field names.) asc ;
3, if the character code of a field data table is GBK, sort wording:
Direct sequencing on the line, because GBK coding has always been sort of Chinese characters to sort initials
the Order by table alias field name asc.;
reference:
https://blog.csdn.net/mawming/article/details/52045771
https://my.oschina.net/u/999578/blog/150392
https://blog.csdn.net/stephenxu111/article/details/4436181
https://blog.csdn.net/w410589502/article/details/58049091
Original link:
https://www.cnblogs.com/poterliu/p/11596334.html