1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
SELECT
F.num_telephone, count(F.duree_fact) AS nbAppTot,
sum(F.duree_fact) AS dureeTot,
sum(F.montant_appel) AS montantTot,
FA.nbAppNat,
FA.dureeNat,
FA.montantNat
FROM facture_appel F JOIN
(SELECT num_facture, num_telephone, count(*) AS nbAppNat,
sum(duree_fact) AS dureeNat,
sum(montant_appel) AS montantNat
FROM facture_appel
WHERE ZONE_APPEL IN ('', 'F')
GROUP BY NUM_FACTURE, NUM_TELEPHONE) FA
ON FA.num_facture = F.num_Facture AND FA.num_telephone = F.num_telephone
WHERE F.num_facture = 'PROV061015F00000897'
GROUP BY F.num_telephone, FA.nbAppNat, FA.dureeNat, FA.montantNat |
Partager