我在Oracle Apex 11.1上有这段代码:
select r.s_manager_id,r.s_manager_nam,count(distinct(emp_id))Total_Employees,
round((SUM(decode(bcoe,'y',1,0))/count(bcoe))*100,2)||'%'bcoe,
round((SUM(decode(ecp,'y',1,0))/count(ecp))*100,2)||'%'ecp,
round((SUM(decode(leave,'y',1,0))/count(leave))*100,2)||'%'leave,
round((SUM(decode(eud,'y',1,0))/count(eud))*100,2)||'%'eud,
round((SUM(decode(parking,'y',1,0))/count(parking))*100,2)||'%'parking,
round((SUM(decode(building,'y',1,0))/count(building))*100,2)||'%'building
from s_manager r,cmanager c,compliancetype t
where r.s_manager_id = c.s_manager_id
AND c.s_manager_id = t.s_manager_id
AND month = 'Feb'
GROUP BY r.s_manager_id,r.s_manager_nam
它会计算不同类型的合规性,但ecp
和bcoe
应该按年计算。如何在Oracle Apex中做到这一点?那么leave
应该每季度计算一次;怎么做?
答案 0 :(得分:0)
其中每一个
round((SUM(decode(FIELD,'y',1,0))/count(FIELD))*100,2)||'%'FIELD
可以简化为
round(AVG(decode(FIELD,'y',1,0))*100,2)||'%'FIELD
对于季度/年度,如果您要显示的年度数据在month = 'Dec'
范围内,并且季度数据在3月,6月等的monts中,那么您将无需转到Google Analytics。
只需以这种方式将计算字段包装为季度数据。
case when month in ('Mar', 'Jun', 'Sep', 'Dec') then
round(AVG(decode(leave,'y',1,0))*100,2)||'%'leave
else 0
end