1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| SELECT rphc.proc_id,rps.step_name,
round(avg( rpha.date_of_action_end - rpha.date_of_action_start),2) average
FROM rphistory_case rphc
INNER JOIN rpcase_attr_1 rpca
ON rpca.case_id = rphc.case_id
INNER JOIN rphistoryaction rpha
ON rpha.case_id = rphc.case_id
INNER JOIN rpstep rps
ON rps.step_id = rpha.step_id
WHERE rpha.action_type = 4
AND rps.step_type = 'NORMAL'
AND rphc.proc_id = 2004
AND rpca.agent_traitant IN( select userid from rplogin_userid where login = 'myLogin')
--AND rpca.pup_id IN (2270,2271,2269,2268)
AND rpca.year_start BETWEEN 2011 AND 2012
GROUP BY rphc.proc_id, rps.step_name
ORDER BY rphc.proc_id, rps.step_name |
Partager