select a.catalog_name,decode(substr(trunc((a.s/b.count2),4)*100||'%',0,1),'.',replace(trunc((a.s/b.count2),4)*100||'%','.','0.'),trunc((a.s/b.count2),4)*100||'%') as percent
from

    (SELECT PARENT_NAME as catalog_name, sum(COUNTNUM) as s
      FROM RES_PRODUCT
     GROUP BY PARENT_NAME) a,
(SELECT sum(countnum) count2 from res_product) b

相关文章: