/*Top 50 event inserts in last 7 days.*/
USE OperationsManagerDW
SELECT TOP (50) COUNT(*) AS Count, Event.vEvent.EventDisplayNumber AS 'EventId', vRule.RuleDefaultName AS 'Collection Rule',
               vManagementPack.ManagementPackDefaultName
FROM  Event.vEventRule INNER JOIN
               vRule ON Event.vEventRule.RuleRowId = vRule.RuleRowId INNER JOIN
               Event.vEvent ON Event.vEventRule.EventOriginId = Event.vEvent.EventOriginId INNER JOIN
               vManagementPack ON vRule.ManagementPackRowId = vManagementPack.ManagementPackRowId
WHERE (Event.vEvent.DateTime BETWEEN DATEADD(day, - 6, GETDATE()) AND GETDATE())
GROUP BY Event.vEvent.EventDisplayNumber, vRule.RuleDefaultName, vManagementPack.ManagementPackDefaultName
ORDER BY Count DESC

Back to SQL queries main menu