select mc,rq,parent_id,count(1) as p_num from pfsc group by mc,rq,parent_id;

解决方案 »

  1.   

     select t.mc,
           to_char(t.rq, 'yyyy') rq,
           r.parent_id,
           count(1) as p_num
      from pfsc t, jgjk_cpfl r
     where t.c_id in (100100, 100111, 100112)
       and t.s_id = r.id
     group by t.mc,to_char(t.rq, 'yyyy'),r.parent_id
      

  2.   

     select t.mc,
           to_char(t.rq, 'yyyy') rq,
           r.parent_id,
           count(1) as p_num
      from pfsc t, jgjk_cpfl r
     where t.c_id in (100100, 100111, 100112)
       and t.s_id = r.id
     group by t.mc,to_char(t.rq, 'yyyy'),r.parent_id

    +1