I would like to query and get for all the records with the same datetime ,filter by Type , Provider and Operator.
If I run select distinct EventStamp I get all the records that I need, but I miss the type , provider and operator.
Like the screenshots if I have the Type OPR I need this record
If all the types are DDE I need Provider RDSSERVER\Intouch.
SELECT [EventStamp] ,[TagName] ,[Description],[Area] ,[Type],[Value], Antes FROM
(
SELECT distinct [EventStamp]
,[TagName]
,[Description]
,[Area]
,[Type]
,[Value]
,[CheckValue] as Antes
FROM [dbo].[v_EventHistory] where type = 'OPR'
UNION
SELECT distinct [EventStamp]
,[TagName]
,[Description]
,[Area]
,[Type]
,[Value]
,[CheckValue] as Antes
FROM [dbo].[v_EventHistory] where type = 'DDE'
)as EV order by EventStamp desc
With this code I miss the type , provider and operator.
I nee like this
Shared query from Hannover (Thank you)