Just for interest, this can be written using the (now deprecated) GROUP BY ALL syntax. This example shows the equivalent query with and without using GROUP BY ALL:
DECLARE @Example TABLE
(
ServerIP varchar(20) NOT NULL,
VID integer NOT NULL
);
INSERT @Example
(ServerIP, VID)
VALUES
('192.168.0.1', 5),
('192.168.0.1', 9),
('192.168.0.2', 3),
('192.168.0.2', 3),
('192.168.0.3', 5),
('192.168.0.4', 9),
('192.168.0.4', 9);
-- Deprecated GROUP BY ALL syntax, do not use
SELECT
e.ServerIP,
COUNT_BIG(*)
FROM @Example AS e
WHERE
e.VID >= 9
GROUP BY ALL
e.ServerIP
-- Equivalent query plan
SELECT
U.ServerIP,
COUNT_BIG(U.Union1001)
FROM
(
SELECT
e.ServerIP,
NULL AS Union1001
FROM @Example AS e
UNION ALL
SELECT
e.ServerIP,
0 AS Union1001
FROM @Example AS e
WHERE
e.VID >= 9
) AS U
GROUP BY
U.ServerIP
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi