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 2008 Forums
 Transact-SQL (2008)
 How to get last 7 days last update_dateTime

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2014-04-16 : 11:19:28
How to get last 7 days max dw_update_date (which is date time)

select 'I_encounters' as JOB_NAME , dw_update_date from I_Encounters
where dw_update_date >= getdate() -7
group by dw_update_date

want to see the last 7 days last or max update date time

Thanks a lot for the helpful info.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2014-04-16 : 12:12:58
Maybe: where dw_update_date >= CAST(getdate() AS DATE) - 7

If that doesn't work you can always follow the links below to help ask you question with the proper information, but I know you won't. :)
http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -