group by 。。。

group by 。。。

 select t2.*,t3.ncount from 
(select groupid, count(id) as ncount  from t_txlEmploy group by groupid) t3, t_txlgroup t2
where  t2.id=t3.groupid(+)
group by t2.id,t3.groupid

构架一张t3 表,字段为“集团编号”,“集团用户数”

然后用“集团表”和t3表再关联

你可能感兴趣的:(group by 。。。)