/*Number of state change events per day for last 28 days.*/
USE OperationsManagerDW
SELECT CONVERT(VARCHAR(10), DateTime, 101) AS Date, COUNT(*) AS 'State Changes'
FROM  State.vStateRaw
WHERE (DateTime BETWEEN DATEADD(day, - 27, GETDATE()) AND GETDATE())
GROUP BY CONVERT(VARCHAR(10), DateTime, 101)
ORDER BY Date DESC

Back to SQL queries main menu