I need to get order numbers by ASC. In my mysql table It written with - (ex. 1-2; 2-3; 15-60 etc.)

我需要通过ASC获得订单号。在我的mysql表中,它是用-(例如1-2;2 - 3;15-60等等)。

Now I get order:

现在我得到订单:

15-60; 1-2; 2-3;

15-60;1 - 2;2 - 3;

why not 1-2; 2-3; 15-60?

为什么不是1 - 2;2 - 3;15-60吗?

I'm making new sorting in my opencart. Tutorial to make new sorting I used: sort by size opencart

我正在我的opencart中进行新的排序。我使用的新排序教程:按大小排序opencart

3 个解决方案

#1


3

You can try with:

你可以尝试:

SELECT *
FROM yourtable
ORDER BY numbers + 0

to automatically cast you VARCHAR column to a number, and apply the order correctly.

将VARCHAR列自动转换为数字,并正确应用订单。

Please see fiddle here.

请在这里看到小提琴。

更多相关文章

  1. PHP的订单生成算法

随机推荐

  1. java中json数据格式的应用
  2. jQuery animate()函数没有动画
  3. 【转】Mozilla研究—深入理解mozilla所需
  4. 总结一些更多的针对webkit的HTML, CSS和J
  5. 韩顺平_轻松搞定网页设计(html+css+javas
  6. Python-html课程基础复习
  7. html中页面传递参数不用cookie不用缓存,j
  8. sp_send_dbmail在body中嵌入mhtml文件
  9. 2个div内容交换不用innerHTML似乎办不到?
  10. 8.HTML5 CSS3 背景、边框与补丁相关属性