Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Select where condition by date and time both

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2010-05-19 : 16:12:14
Is it possible to have a where condition by datetime, instead of just time.

ORDER BY OrderDate DESC

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-05-19 : 16:17:11
"just time"?? There is only a datetime field in 2005.

What is the datatype of your OrderDate field and what does it contain?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-20 : 09:36:46
ORDER BY dateadd(day,datediff(day,0,OrderDate),0) DESC

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2010-05-20 : 12:41:55
Sorry, I screwed up my question it is order by datetime instead of just date.

Right now the order by is doinhg just by date.

Instead need it by datetime.

Thank you very much for the helpful info.

Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-05-20 : 14:18:15
Still need answer for this..
quote:
What is the datatype of your OrderDate field and what does it contain?
Go to Top of Page
   

- Advertisement -