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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Rolling Week Date Range

Author  Topic 

JasonW
Starting Member

1 Post

Posted - 2015-04-22 : 19:41:03
Hi there,

I am new to the forum and SQL. I require some scripting to return data which sits in a rolling weeks date range of the current week.

For example, on a Monday I want to return data from the previous day (Sunday to the previous Monday).
On a Tuesday I want to return data from the previous day (Monday to the up coming Sunday).
On a Wednesday I want to return data from the Monday (previous 2 days ago to the upcoming Sunday)
On a Thursday I want to return data from the Monday (previous 3 days ago to the upcoming Sunday)

And so forth.

So I have my SQL script which works with static, fixed date ranges. But I need this additional dynamic date range logic built in.

Can anyone help me with this please?

Many thanks,

Jason

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-04-23 : 09:28:33
Please post your current script
Go to Top of Page
   

- Advertisement -