Someone from another forum helped me out. Here's the result:SELECT N1.Caption as NodeName, SUM(CASE WHEN R1.PercentLoss > 0 THEN 1 ELSE 0 END) as Greater_Than_0, SUM(CASE WHEN R1.PercentLoss > 50 THEN 1 ELSE 0 END) as Greater_Than_50FROM Nodes N1 INNER JOIN ResponseTime R1ON N1.NodeID = R1.NodeIDGROUP BY N1.CaptionORDER BY N1.Caption
Would give three columns along the lines of:NodeName Greater_Than_0 Greater_Than_50Node1 10 5Node2 20 0etc...
This would cover the entire date range in your data which is probably not very useful in day to day use so you would probably want to add a date range in (as a where statement) or (more likely) add in another column to show the month.If the count / total is misleading (e.g. packet losses happen in clusters) then you might want something like:SELECT t.NodeName, COUNT(*) as OccsFROM(SELECT YEAR([DateTime]) as Y, MONTH([DateTime]) as M, N1.Caption as NodeName, MAX(R1.PercentLoss) AS Max_Packet_LossFROM Nodes N1 INNER JOIN ResponseTime R1ON N1.NodeID = R1.NodeIDGROUP BY YEAR([DateTime]) , MONTH([DateTime]), N1.Caption HAVING MAX(R1.PercentLoss)>50 ) tGROUP BY t.NodeName