mysql order by

一、多字段进行排序

select * from student order by classID ASC,stuName ASC;
#多个字段排序的时候,先按照第一个排序,再在第一个排序的基础上按第二个排

二、对字段中包含汉字进行排序

会将此字段转化为相应的编码进行排序

select * from student order by stuName ASC;
#stuName字段采用UTF8编码
#也可以使用别的编码
select * from student order by convert(stuName using gbk);

一    一    
二    二    
三    三    
四    四    
z     &#x007a
以上为各字对应的UTF8编码

 

posted @ 2017-03-16 16:09  暗夜心慌方  阅读(134)  评论(0)    收藏  举报