因此,我从执行聚合函数获得了以下这些列: Table
SELECT MachineName,
(100*((1)
-((
sum(CASE p1.CounterName
WHEN 'Available Bytes' THEN
p2.CounterValue
ELSE
0
END)
/NULLIF(
(sum(CASE p1.CounterName
WHEN 'Available Bytes' THEN
p2.CounterValue
ELSE
0
END)
+
sum(CASE p1.CounterName
WHEN 'Committed Bytes' THEN
p2.CounterValue
ELSE
0
END)
+
sum(CASE p1.CounterName
WHEN 'Modified Page List Bytes' THEN
p2.CounterValue
ELSE
0
END)),0) )))) As Memory
我只希望选择需要> 75的“内存”,但是我对SQL和聚合函数不够熟悉,因此我不确定是否可行。
答案 0 :(得分:0)
您可以尝试使用以下子查询-
select * from
(
SELECT MachineName,
(100*((1)
-((
sum(CASE p1.CounterName
WHEN 'Available Bytes' THEN
p2.CounterValue
ELSE
0
END)
/NULLIF(
(sum(CASE p1.CounterName
WHEN 'Available Bytes' THEN
p2.CounterValue
ELSE
0
END)
+
sum(CASE p1.CounterName
WHEN 'Committed Bytes' THEN
p2.CounterValue
ELSE
0
END)
+
sum(CASE p1.CounterName
WHEN 'Modified Page List Bytes' THEN
p2.CounterValue
ELSE
0
END)),0) )))) As Memory
)A where memory>75