1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| SELECT
count(num) AS total
FROM
(
SELECT
p1.NUMBERPRGN,
(nvl(to_number((EXTRACT(MONTH FROM c2.CLOSED_TOTAL)-1 )*40500)+((EXTRACT (DAY FROM c2.CLOSED_TOTAL)-1)*1350)+((EXTRACT (HOUR FROM TO_TIMESTAMP( TO_CHAR (c2.CLOSED_TOTAL, 'DD/MM/YY HH24:MI:SS'), 'DD/MM/YY HH24:MI:SS' )))*60) +EXTRACT (MINUTE FROM TO_TIMESTAMP(TO_CHAR (c2.CLOSED_TOTAL, 'DD/MM/YY HH24:MI:SS'), 'DD/MM/YY HH24:MI:SS' )),0)
- -- <-- C'est un moins (-)
nvl(to_number((EXTRACT(MONTH FROM c4.CLOSED_TOTAL)-1 )*40500)+((EXTRACT (DAY FROM c4.CLOSED_TOTAL)-1)*1350)+((EXTRACT (HOUR FROM TO_TIMESTAMP( TO_CHAR (c4.CLOSED_TOTAL, 'DD/MM/YY HH24:MI:SS'), 'DD/MM/YY HH24:MI:SS' )))*60) +EXTRACT (MINUTE FROM TO_TIMESTAMP(TO_CHAR (c4.CLOSED_TOTAL, 'DD/MM/YY HH24:MI:SS'), 'DD/MM/YY HH24:MI:SS' )),0)
) AS TOT
FROM
servicec.PROBSUMMARYM1 p1
LEFT JOIN servicec.CLOCKSM1 c2
ON p1.numberprgn = c2.key_char
AND c2.NAME = 'Total temps passé'
LEFT JOIN servicec.CLOCKSM1 c4
ON p1.numberprgn = c4.key_char
AND c4.name = 'GROUPE-Pending'
WHERE
p1.close_time IS NOT NULL
AND priority_code ='4'
AND cly_group_suivi_hd = 'SERVICE DESK'
AND p1.close_time BETWEEN '01/02/2009' AND '28/02/2009'
and (c2.name is not null or c4.name is not null)
)
WHERE
tot < 840 |