感谢各位,我用了楼上“danis_cn(宇宙鸟)”, 在phpmyadmin出现错误提示如下:错误 SQL 查询: SELECT * FROM `xiaohua` ORDER BY CONVERT( int, all_no ) DESC LIMIT 0 , 30 MySQL 返回: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int , all_no ) DESC LIMIT 0, 30' at line 1
convert函数是mysql在4.02版本中加入的函数 你看看你的mysql版本号,是否支持?
SELECT * FROM `xiaohua` ORDER BY CONVERT( int, all_no ) DESC LIMIT 0 , 30
顺排ASC(默认)
逆排DESC
在phpmyadmin出现错误提示如下:错误
SQL 查询: SELECT *
FROM `xiaohua`
ORDER BY CONVERT( int, all_no ) DESC
LIMIT 0 , 30 MySQL 返回: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int , all_no ) DESC
LIMIT 0, 30' at line 1
你看看你的mysql版本号,是否支持?
FROM `xiaohua`
ORDER BY CONVERT( int, all_no ) DESC
LIMIT 0 , 30
在每行上作convert会导致该查询很慢
如果 比较负责我建议你做个 后台辅助的数据处理程序
我一般用C 来做,我们公司这种事情太多了....