Hi Guys,
I need some help with adjusting an existing query to to include a TimeStamp, which is actually the "DateTime" column in one of the views (vEvent, System Center Operations Manager Data Warehouse).
Long story short - I needed help to get some data in a specific form, so asked in the forums and after short discussion I got the query I needed. Here is the post:
T-SQL query to present the data in an more understandable/readable way
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/445785f6-b013-48c6-8dbf-e4d218f591a0/tsql-query-to-present-the-data-in-an-more-understandablereadable-way?forum=transactsql&prof=required
This post resulted in the following solutions, which works and delivers the data I need:
select ev.EventOriginId,
MAX(CASE WHEN ParameterIndex=1 THEN ParameterValue END) ParamtereValue1,
MAX(CASE WHEN ParameterIndex=2 THEN ParameterValue END) ParamtereValue3,
MAX(CASE WHEN ParameterIndex=3 THEN ParameterValue END) ParamtereValue3
FROM Event.vEvent ev inner join Event.vEventParameter evp
on ev.EventOriginId = evp.EventOriginId WHERE EventDisplayNumber = '2889'
GROUP BY ev.EventOriginId
The thing is that I now have to know the date of the respective events, so I tried modifying the query as the "DateTime" is a column from vEvent (same as EventOriginId). Unfortunately this query starts executing and never ends :
select ev.EventOriginId,ev.DateTime,
MAX(CASE WHEN ParameterIndex=1 THEN ParameterValue END) ParamtereValue1,
MAX(CASE WHEN ParameterIndex=2 THEN ParameterValue END) ParamtereValue3,
MAX(CASE WHEN ParameterIndex=3 THEN ParameterValue END) ParamtereValue3
FROM Event.vEvent ev inner join Event.vEventParameter evp
on ev.EventOriginId = evp.EventOriginId WHERE EventDisplayNumber = '2889'
GROUP BY ev.EventOriginId,ev.DateTime
Can you please help me to include the "DateTime" in the results?
Many thanks in advance for all suggestions!
Regards,
Stoyan