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 M.ITEM, I.LIBEL, I.DECIMALE, T.PU,
NVL(SUM(DECODE(M.SENS, 2, M.MT_MN)) / SUM(DECODE(M.SENS, 2, M.QTE * M.QTE2)), 0) -
NVL(SUM(DECODE(M.SENS, 1, M.MT_MN)) / SUM(DECODE(M.SENS, 1, M.QTE * M.QTE2)), 0) ,
NVL(SUM(DECODE(M.SENS, 2, M.MT_TTC)) / SUM(DECODE(M.SENS, 2, M.QTE * M.QTE2)), 0) -
NVL(SUM(DECODE(M.SENS, 1, M.MT_TTC)) / SUM(DECODE(M.SENS, 1, M.QTE * M.QTE2)), 0) ,
NVL(SUM(DECODE(M.SENS, 2, M.QTE * M.QTE2)) ,0) - NVL(SUM(DECODE(M.SENS, 1, M.QTE * M.QTE2)), 0),
(SELECT NVL(SUM(DECODE(M2.SENS, 2, M2.QTE * M2.QTE2)), 0) -
NVL(SUM(DECODE(M2.SENS, 1, M2.QTE * M2.QTE2)), 0)
FROM E_MVT M2
WHERE M2.STE = 'UC'
AND M2.EX = '10'
AND M2.ITEM = M.ITEM)
FROM E_MVT M
LEFT OUTER JOIN S_ITEM I
ON I.ITEM = M.ITEM
AND I.STE = M.STE
LEFT OUTER JOIN S_TARIF T
ON T.ITEM = M.ITEM
AND T.STE = M.STE
AND T.TARIF = 'BASE'
WHERE M.STE = 'UC'
AND M.EX = '10'
AND M.JNL = 'FCC_B'
AND M.CPTE LIKE '707%'
AND M.DATCPT = to_date('28/08/2010' , 'dd/mm/yyyy')
GROUP BY M.ITEM, I.LIBEL, I.DECIMALE, T.PU
ORDER BY M.ITEM ASC; |
Partager