通常,排序是通过将符号排在顶部来完成的,例如0或*或&.这是mysql排序的默认方式.数字和符号,然后按A-Z.但是,这会使通常最丑陋或格式最糟糕的结果浮动到顶部(例如@#$@3423或8 inch或&的结果).
Often, sorting is done with symbols sorted to the top, like 0 or * or &. This is the default way that mysql sorts; numbers and symbols and then A-Z. However, that makes the often ugliest or most badly formatted results float to the top (e.g. a result of @#$@3423 or 8 inch or &).
所以我想做一个修改后的形式,先字母A-Z,然后是特殊字符.
So I'd like to do a modified form of that, letters first A-Z, and then special characters last.
我将如何创建这种类型的排序? ORDER BY子句中有内容?
How would I go about creating that type of sort? Something in the ORDER BY clause?
推荐答案基于此页面的Google缓存链接: www.googlecom. ?sa = t& source = web& cd = 3& ved = 0CCUQFjAC& url = http%3A%2F%2Fblog.feedmarker%2F2006%2F02%2F01%2Fhow-to-do-natural-alpha-numeric-sort -in-mysql%2F& ei = Zg2_TZyKDaffiALjjqwo& usg = AFQjCNGS-rX7AmfrumXK8J7bVSj96bSSmQ
Based on a google-cached link to this page: www.google/url?sa=t&source=web&cd=3&ved=0CCUQFjAC&url=http%3A%2F%2Fblog.feedmarker%2F2006%2F02%2F01%2Fhow-to-do-natural-alpha-numeric-sort-in-mysql%2F&ei=Zg2_TZyKDaffiALjjqwo&usg=AFQjCNGS-rX7AmfrumXK8J7bVSj96bSSmQ
原始链接已死. 这是另一个链接,它实际上解释了比第一个链接更好的事情:
Original link is dead. Here is another link which actually explains what is happening better than the first link did:
matthewturland/2008/11/05 /natural-ordering-in-mysql/
您可以尝试
SELECT names FROM your_table ORDER BY names + 0 ASC