title: How to get a count of occurrences in a timeframe of 7 and 30 days in SQL?
body: <p>I have a table <code>Emp</code> and I want to get the count of records starting from a particular date to next seven days for each unique ID.</p>
  <p>For instance, there are two occurrences of ID1 each day from 2020-11-01 to 2020-11-07, then the count for this ID would be 14.</p>
  <p>Next, the count would start from 2020-11-08 to 2020-11-14 and so on for each given ID. The same question holds for a range of 30 days.</p>
  <p>I have tried <code>DATEADD()</code>, <code>GETDATE()</code> and <code>DATEDIFF()</code>, but none of them return the correct output.</p>
  <p>It's easy to get the count for a given date but seems a bit tricky to get the same for a range. Any help would be appreciated.</p>