我有一张像
Server Instance
MURDW02D WinA3_NetInstances
MURDW02D WinA3_MemVirt
MURAW06D WinA3_CPU
MURDW02D WinA3_NetInst
MURDW02D WinA3_CPUInst
MURAW06D WinA3_Net
MURDW02D WinA3_Mem
MURDW01D WinA3_Mem
MURDW01D WinA3_CPUInst
MURDW02D WinA3_Net
MURDW02D WinA3_CPUInst
MURAW07D WinA3_Net
我想选择 MURDW01D 和 MURDW02D ,因为它们有WinA3_Mem和WinA3_CPUInst通用。可能有 3 个常见的字段。另外,我想要有这个共同点的服务器的数量是 2 在这种情况下是可能的。
查询已尝试
SELECT * FROM (SELECT HOSTNAME AS [Host], CLASS AS [class] FROM oncall) AS s PIVOT(COUNT(CLASS) FOR [CLASS] IN (WinA3_Proc)) AS pivot
这可能不是 100% 确定的,我有 50K 记录和 170 个实例,我正在寻找这些服务器上常见的实例。
SELECT COUNT(*) AS Expr1
FROM oncall
WHERE (CLASS LIKE '%WinA3%') AND (CLASS LIKE '%WinA3_CPUInst%')