你这思路有点乱,应该是两个查询:
SELECT G."ID",G."NAME",COUNT(*)
FROM "GROUPS" G,USERS U
WHERE G."ID"=U."GROUPID"
GROUP BY G."NAME",G."ID"
select avg(cnt) from
(SELECT G."ID",G."NAME",COUNT(*) cnt
FROM "GROUPS" G,USERS U
WHERE G."ID"=U."GROUPID"
GROUP BY G."NAME",G."ID"
) tmp
1、count(*)==count(1)再avg肯定是1,没有意义
2、select g.id,g.name,count(*),sum(col1),avg(col2) from groups g,users u where g.id=u.groupid group by g.name,g.id;