1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
select ARTICLE,STOCK,EN_FAB,
DECODE(D.T$OSTA,2,'PLANIFIE',3,'PLANNING',4,'LANCE',5,'ACTIF') STATUT
from
(SELECT
A.T$ITEM ARTICLE,C.T$STOC STOCK,C.T$ORDR EN_FAB,
sum(case when D.T$OSTA in (2,3,4,5) then 1 else 0 end;) CPT_STATUT
FROM
TTIITM001420 A,TTDINV001420 C,TTISFC001420 D
WHERE
A.T$ITEM = C.T$ITEM
AND A.T$ITEM = D.T$MITM
AND C.T$ITEM LIKE '644%'
group by
A.T$ITEM ARTICLE,C.T$STOC STOCK,C.T$ORDR EN_FAB;) A,
TTISFC001420 D
where ARTICLE = D.T$MITM
and (D.T$OSTA in (2,3,4,5) or CPT_STATUT=0) |
Partager