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 |
|
accessdbguru
Starting Member
26 Posts |
Posted - 2012-02-01 : 14:47:31
|
| I need to write a query to pull 30 days from current date. Field name [Timestamp] format is DateTime. How i do this? SELECT TimeStamp, ApplicationName, PercentageValueFROM dbo.SMS_Application_StatusWHERE (TimeStamp = GETDATE() - (DATEDIFF, 'day', GETDATE()-30); |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-01 : 15:03:07
|
| [code]...WHERE TimeStamp >= DATEADD(day,DATEDIFF( day, 0,GETDATE())-30,0)AND TimeStamp < DATEADD(day,DATEDIFF( day, 0,GETDATE())+1,0)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|