对你的意思不太明白。你用substr函数试一下
select substr('020101',2,2) from dual;

解决方案 »

  1.   

    select substr('020101',1,2) from dual;
      

  2.   

    select * from tPower where substr('EmpId',1,2)=02
      

  3.   

    楼主的功能好像用一个简单的SQL语句没法实现,需要用函数或是存储过程,先取道EmpId(可以查询的职员类型编号),然后在一个一个的操作
      

  4.   

    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,这个自己修改一下吧.