按字母顺序对MySQL结果进行排序,但最后一个数字

编程入门 行业动态 更新时间:2024-10-27 02:20:46
本文介绍了按字母顺序对MySQL结果进行排序,但最后一个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

通常,排序是通过将符号排在顶部来完成的,例如0或*或&.这是mysql排序的默认方式.数字和符号,然后按A-Z.但是,这会使通常最丑陋或格式最糟糕的结果浮动到顶部(例如@#$@3423或8 inch或&amp的结果).

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 &amp).

所以我想做一个修改后的形式,先字母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

更多推荐

按字母顺序对MySQL结果进行排序,但最后一个数字

本文发布于:2023-11-30 10:03:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649593.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字母   顺序   数字   MySQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!