Home > Backend Development > PHP Tutorial > mysql的排序问题

mysql的排序问题

WBOY
Release: 2016-06-23 14:38:14
Original
794 people have browsed it

我用order by time排序一个表格
可是排出来的结果是 0 10 100 1000 1010 1020 110 120...这样的
我想让排序结果是从小到大排 请问能实现么?
求指教~


回复讨论(解决方案)

你的 time 字段是字符型的?
order by time+0
就可以了

time 是什么类型

把time转换成整型

order by CAST(time AS UNSIGNED) 

就可以了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template