按日期排序??
我有一个数据:
id date
1 2007-08-14 17:00:00:44.777
2 2007-08-07 13:01:44:22.442
3 2006-08-01 14:00:44:42.422
我只想按日期排序,时间不加入排序,怎么办?
------解决方案--------------------我有一个数据:
id date
1 2007-08-14 17:00:00:44.777
2 2007-08-07 13:01:44:22.442
3 2006-08-01 14:00:44:42.422
select * from tb order by convert(varchar(10),date , 120) --desc
------解决方案--------------------select * from table name order by convert(char(10),date,120)
------解决方案--------------------id date
1 2007-08-14 17:00:00:44.777
2 2007-08-07 13:01:44:22.442
3 2006-08-01 14:00:44:42.422
我只想按日期排序,时间不加入排序,怎么办?
----------------
select * from t order by convert(varchar(10),date,120)
------解决方案--------------------select * from tb order by select convert(char(8),date,112)
------解决方案--------------------select * from tb order by convert(char(8),date,112)
------解决方案--------------------排序时自动按日期排序,日期相同时再按时间排,没有问题吧?