I have the following table which contains ID's and UserId's.
TotalID Total_UserID Average
2 7 3.5
INNER JOIN b ON someID = someID
WHERE a.ID IN ( SELECT ID FROM c WHERE GROUPID = 9999)
GROUP BY a.ID
SELECT COUNT(*) FROM (
You seem to want this:
SELECT COUNT(DISTINCT a.ID), COUNT(b.UserID), COUNT(b.UserID) * 1.0 / COUNT(DISTINCT a.ID) FROM a INNER JOIN b ON someID = someID WHERE a.ID IN ( SELECT ID FROM c WHERE GROUPID = 9999);
DISTINCT is not a function. It applies to the whole row, so it is misleading to put an expression in parentheses after it.
GROUP BY is unnecessary.
1.0 is because SQL Server does integer arithmetic and this is a simple way to convert a number to a decimal form.