方法一:先按照长度排序再按照ASCII码排序
select display_name from desktop order by display_name desc, length(display_name) desc;
方法二:向前/左用空格补齐32位后再排序
select display_name from desktop order by LPAD(display_name, 32, ‘ ‘) desc;
补充:向后/右补齐为RPAD(str,len,padstr)
mysql 字符串先按照长度排序再按照ASCII码排序
原文地址:https://www.cnblogs.com/aaron-agu/p/14467579.html