I have a datetime field and an autoincrement ID field (this is MS SQL Server). I'm doing a select and I want to order by the date portion of the datetime, ignoring the time portion, like this...
select .... order by mydatetimefield desc, ID
but ignore the time in the mydatetimefield. Any ideas?
I found this...
cast(CONVERT(varchar(8), mydatetimefield, 112) AS datetime
which converts it to just a date, but was thinking if I start ordering by that, it might slow things down a lot...
select .... order by mydatetimefield desc, ID
but ignore the time in the mydatetimefield. Any ideas?
I found this...
cast(CONVERT(varchar(8), mydatetimefield, 112) AS datetime
which converts it to just a date, but was thinking if I start ordering by that, it might slow things down a lot...