0

I have a SQL question. Is there a way to get a range of dates from Sunday to Saturday.

I saw individual dates were discussed before but I don't see the range of 7 days.

WHERE DATE BETWEEN @LastSunday AND @LastSaturday

If someone knows, would be great.

Stephansko
  • 33
  • 6
  • 1
    Does this answer your question? [How to get the date from last Sunday to Saturday](https://stackoverflow.com/questions/23391658/how-to-get-the-date-from-last-sunday-to-saturday) – Ken White Jan 06 '22 at 03:33
  • @KenWhite thank you. I saw they used this code WHERE CONVERT(DATE, CONVERT(CHAR(8),DATE )) >= DATEADD(d, -8, DATEADD(dd, DATEDIFF(dd,0, current_timestamp), 0)) --PREVIOUS SUNDAY AND CONVERT(DATE, CONVERT(CHAR(8),DATE )) <= DATEADD(d, -1, DATEADD(dd, DATEDIFF(dd,0, current_timestamp), 0)) --PREVIOUS SATURDAY; I get for some reason instead of 12/26 - 01/01 I get 12/28 - 01/04... – Stephansko Jan 06 '22 at 03:38

0 Answers0