首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

mysql忽略空的行降序排序解决方案

2012-03-08 
mysql忽略空的行降序排序数据库是id time1122335566778899请问怎么按字段time降序排序?我试了“select * fr

mysql忽略空的行降序排序
数据库是
id time
1 1
2 2
3 3

5 5
6 6
7 7
8 8
9 9
请问怎么按字段time降序排序?我试了“select * from 表 order by 字段”的确能按字段time降序排序,结果显示
id time
1 1
2 2
3 3

5 5
6 6
7 7
8 8
9 9
因为有一行是空的,所以显示成这样,请问有什么办法显示的时候忽略了空的那一行,然后按time降序排序,因为某些原因,数据库有些行一定要空的,不能改变,请问怎么忽略空的行然后按time字段降序排序。谢谢

[解决办法]
select *
from table
where time is not null or time!=""
order by time desc

你吧time字段空值去掉就行了。

热点排行