Skip to content
Advertisement

Count of files received in the last 30 days split by each day

I am trying to get a count of the number of files my company has received in the past month split up by each day. The example below shows what I want the output to look like.

| Date-  | | -Received- |
|--------| |------------|
| 2/1/20 | |  -  16 -   |
| 2/2/20 | |   - 26 -   |
| 2/3/20 | |   - 14 -   |
| 2/4/20 | |   - 32 -   |

The PK for my table is RecNo and the date variable is DateRecd.

Thank you in advance!

Advertisement

Answer

Do you just want aggregation and filtering?

select date, count(*)
from t
where date > convert(date, dateadd(day, -30, getdate()))
group by date
order by date;
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement