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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
SELECT typ.idttypligfac
, lig.idtfac
, prm.mnt prime
, pb.mnt pb
, rst.mnt ristourne
, bcs.mnt backservice
, t.mnt transfertin
FROM type_ligne_facture_nl typ
, ligne_facture_nl lig
, detail_ligne_facture_nl prm
, detail_ligne_facture_nl pb
, detail_ligne_facture_nl rst
, detail_ligne_facture_nl bcs
, detail_ligne_facture_nl t
WHERE typ.idttypligfac = lig.idttypligfac
AND prm.idtligfac(+) = lig.idtligfac
AND pb.idtligfac(+) = lig.idtligfac
AND rst.idtligfac(+) = lig.idtligfac
AND bcs.idtligfac(+) = lig.idtligfac
AND t.idtligfac(+) = lig.idtligfac
AND prm.idtnarprm(+) = 1
AND pb.idtnarprm(+) = 2
AND rst.idtnarprm(+) = 3
AND bcs.idtnarprm(+) = 4
AND t.idtnarprm(+) = 5
UNION
SELECT idttypligfac
, idtfac
, NULL
, NULL
, NULL
, NULL
, NULL
FROM facture_nl fac
, type_ligne_facture_nl
WHERE (idttypligfac, idtfac) NOT IN (
SELECT typ.idttypligfac
, lig.idtfac
FROM type_ligne_facture_nl typ
, ligne_facture_nl lig
, detail_ligne_facture_nl prm
, detail_ligne_facture_nl pb
, detail_ligne_facture_nl rst
, detail_ligne_facture_nl bcs
, detail_ligne_facture_nl t
WHERE typ.idttypligfac = lig.idttypligfac
AND prm.idtligfac(+) = lig.idtligfac
AND pb.idtligfac(+) = lig.idtligfac
AND rst.idtligfac(+) = lig.idtligfac
AND bcs.idtligfac(+) = lig.idtligfac
AND t.idtligfac(+) = lig.idtligfac
AND prm.idtnarprm(+) = 1
AND pb.idtnarprm(+) = 2
AND rst.idtnarprm(+) = 3
AND bcs.idtnarprm(+) = 4
AND t.idtnarprm(+) = 5)
ORDER BY idtfac
, idttypligfac; |
Partager