How to select data between today and the next 7 days
Asked
Active
Viewed 412 times
0
-
4look up the t-sql keywords/functions `BETWEEN`, `GetDate()`, and `DATEADD`. – Sam Axe Mar 27 '17 at 22:49
-
Keep in mind that getting the date range of a specific week and getting a date range for the next 7 days are different actions. You will get unexpected results if you expect one but query for another. – mallan1121 Mar 27 '17 at 22:58
-
For the duplicate just change -7 to 7. Dateadd(day,7,getdate()) – S3S Mar 27 '17 at 23:21
1 Answers
1
like the comments says between and DATEADD should help you.
SELECT Created_Date, GETDATE() as Curr_Date FROM MY_TABLE WHERE Created_Date between GETDATE() and DATEADD(day,7, GETDATE())

Dinch
- 548
- 4
- 9