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 2000 Forums
 Transact-SQL (2000)
 get date minus one hour

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-04-11 : 02:00:11
I know what if I do
select * from users where mydate>getdate()-1 I will get all users for that day.

How can I do the same statement but for all users where mydate is in the last hour?

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-04-11 : 02:07:57
select * from users where mydate>dateadd(hh,-1,getdate())

check dateadd in Books On Line (BOL)

Cheers

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -