I have a view that im trying to do a select statement from, the set looks something like this.
ComputerName Counter Counter Instance Value Time(UTC)
SPITERMINAL1 Free Megabytes C: 7272 2015-11-19 00:00:00.000
NAWSRAP033894 Free Megabytes D: 3723 2015-11-19 00:03:00.000
NAWSRAP033894 Free Megabytes C: 4298 2015-11-19 00:03:00.000
aasldsrv10 Free Megabytes X: -999 2015-11-19 00:03:00.000
aasldsrv10 Free Megabytes W: -999 2015-11-19 00:03:00.000
Solomon Free Megabytes F: 25491 2015-11-19 00:03:00.000
BSCVHOSTDC Free Megabytes E: 40796 2015-11-19 00:03:00.000
BSCVHOSTDC Free Megabytes C: 21859 2015-11-19 00:03:00.000
usccgm-dev Free Megabytes C: 22279 2015-11-19 00:03:00.000
USCCSCANSAFE Free Megabytes C: 2490 2015-11-19 00:00:00.000
What i want is the minimum value for each counter instance on computername for each day. I am new to SQL any help is greatly appriciated. My current script looks like this:
select top 1000 [ComputerName] As 'Computername'
,min([Value]) As 'Value'
,(SELECT DISTINCT DATEADD(day, 0, DATEDIFF(day, 0, [Time(UTC)]))) AS [Time(UTC)]
where counter = 'Free megabytes' and [Value] > 1
group by [ComputerName], [Counter Instance], Value, [Time(UTC)]