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.
Author |
Topic |
sql_angel
Starting Member
2 Posts |
Posted - 2011-07-25 : 12:55:41
|
Hi, I just wonder if there is any way to compare time in regular sql?i need to do a select query that returns all entries that are not older than 7 days.thank you, |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-07-25 : 12:59:10
|
[code]select * from yourtable where youdatefield > DATEADD(dd,DATEDIFF(dd,0,GETDATE()),-7)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sql_angel
Starting Member
2 Posts |
Posted - 2011-07-25 : 14:03:52
|
thank you, visakh16that's what exactly i need |
|
|
|
|
|