I’d like to do it in one statement if possible.
My original query was this:
SELECT CAST(Date as DATE) as DayDate, SUM(Books) as LostBooks
FROM RestartBooksView
WHERE Name = 'AUHT167' and Date > (getdate() - 105)
GROUP BY CAST(Date as DATE)
ORDER BY CAST(Date as DATE) ASC
The problem with this query is that I want the summations to be reflected by a 7 AM to 7 AM day rather than the 12 AM to 12 AM day currently. How can I modify my query to reflect this change?
Assuming the column “date” is really a datetime.
I also used SQL Server date functions, since you seem to be using that database.