SMS SQL for Count of Status Messages

The following SQL query returns a count of status messages by year, month, day, hour. The dateadd function subtracts 3 days from todays date, giving us counts for the last 3 days.

----Begin SQL----

--Count of Status Messages Broken Down by Year, Month, Day, Hour
Select Datepart(yy,time), Datepart(mm,time), Datepart(dd,time), Datepart(hh,time), Count(*)
FROM StatusMessages
Where Time > dateadd(dd, -3, getdate())
Group By Datepart(yy,time), Datepart(mm,time), Datepart(dd,time), Datepart(hh,time)

----End SQL----

Comments

Popular posts from this blog

SMS "Program failed (run time exceeded)" 10070

SMS "Waiting for User Condition" 10036

SMS "Waiting for content" 10035