Dears, I have written below inner join query to get the data from my database tables. But output of this data is coming up with almost 3k lines. Output is below. I need data in only unique recent "TimeSampled" rows
select DISTINCT DisplayName, ObjectName, CounterName, InstanceName, SampleValue, max(TimeSampled) as TimeSampled from PerformanceDataAllView pdv with (NOLOCK) inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId where ObjectName = 'Processor' AND TimeSampled >= DATEADD(MINUTE,-5,GETDATE()) AND DisplayName Like '%' group by [PATH], [DisplayName], [ObjectName], [CounterName], [InstanceName], [SampleValue]
How I can retrieve results with only last Time Sampled rows with respect to DisplayName. I have almost 5k servers (DisplayName) like this to retrieve the data.
Request to need to a help to achieve this.