I'm trying to write a query to pull some results by date and have a running summary until the month end. I can't figure out how to write the where clause. For example, I'd like to have the report count how many records were added in the last 24 hours (I believe this is working how I have it below), but also how many were added month-to-day. Next month the count would have to reset. Can someone help with this?
SELECT @RowCount = COUNT(*)
WHERE (DATEDIFF(DAY,[dateLastUpdated],GETDATE()) <= 1) --this is for the last 24 hours