Hi, I have the below query:
SELECT distinct servername, eventid,
DATEPART(hour, slastoccurrence) AS HourOfDay,
DATEADD(dd,DATEDIFF(dd,0,slastoccurrence),0) AS Date,
SUM(tally) AS NumberOfEvents,
SUM(COUNT(*)) OVER(PARTITION BY DATEADD(dd,DATEDIFF(dd,0,slastoccurrence),0)) as DayTotal,
SUM(COUNT(*)) OVER(PARTITION BY servername, DATEADD(dd,DATEDIFF(dd,0,slastoccurrence),0)) as DayTotalByServer
FROM datatable
WHERE
sfirstoccurrence >= '2012-11-21' and sfirstoccurrence < '2012-11-22' and
slastoccurrence >= '2012-11-21'
AND slastoccurrence < '2012-11-22'
GROUP BY
servername,
eventid,
DATEPART(hour, slastoccurrence),
DATEADD(dd,DATEDIFF(dd,0,slastoccurrence),0)
order by hourofday
This query gives an individual total for each "eventID" within each hour, but I would like to simplify it to give a total "NumberOfEvents" within each hour....I'm no longer interested in the total for each individual event id....
Not sure how to do this, can anyone help please?
Thanks