Skip to content

Instantly share code, notes, and snippets.

@adamstrickland
Created August 22, 2011 19:41
Show Gist options
  • Save adamstrickland/1163315 to your computer and use it in GitHub Desktop.
Save adamstrickland/1163315 to your computer and use it in GitHub Desktop.
use enterprise
go
with events (exceptionInfo, eventMessageDate) as (
select top 10000
M.exceptionInfo, M.eventMessageDate
from serviceEvent E
inner join serviceEventMessage M on E.eventId = M.eventId
where username = 'john.mcgilberry'
--where eventMessageDate >= '8/15/2011'
)
select top 100
Q.exceptionInfo as Trace,
MAX(E.eventMessageDate) as [Timestamp]
from (select distinct exceptionInfo from events) Q
inner join events E on Q.exceptionInfo = E.exceptionInfo
group by Q.exceptionInfo
order by 2 desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment