UserId(用户编号),EmpId1.假如大家都是02,但是不可以互相看的话,就是不做为统计的对象. select count(distinct UserId) from tPower, (select EmpId from tPower where UserId = '0001') T2 where substr(tPower.EmpId,1,length(t2.EmpId)) = t2.EmpId and length(tPower.EmpId) > length(t2.EmpId)2.假如大家都是02,可以互相看的话,就是作为统计的对象. select count(distinct UserId) -1 from tPower, (select EmpId from tPower where UserId = '0001') T2 where substr(tPower.EmpId,1,length(t2.EmpId)) = t2.EmpId外联的时候,我用了tPower,你好像是需要tEmp,这个自己修改一下吧.
select count(distinct UserId) from tPower,
(select EmpId from tPower where UserId = '0001') T2
where substr(tPower.EmpId,1,length(t2.EmpId)) = t2.EmpId
and length(tPower.EmpId) > length(t2.EmpId)2.假如大家都是02,可以互相看的话,就是作为统计的对象.
select count(distinct UserId) -1 from tPower,
(select EmpId from tPower where UserId = '0001') T2
where substr(tPower.EmpId,1,length(t2.EmpId)) = t2.EmpId外联的时候,我用了tPower,你好像是需要tEmp,这个自己修改一下吧.