Bonjour,

J'ai 3 requêtes qui sont presque les mêmes, ce qui change sont quelques condition dans le Where, serai t il possible de fusionner ces 3 requêtes pour n'en faire qu'une seule ?

Les voiçi donc :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
select ddv.NOM_DDV, ca_gecaprod.DOM_VENTE, sum(ca_gecaprod.CA_MOIS) as CA_CUM_N1
from ca_gecaprod,client,vendeur,rdv,ddv
where ca_gecaprod.ID_CLT = client.ID_CLT and client.VL = vendeur.NOM_VENDEUR and vendeur.ID_RDV = rdv.ID_RDV and rdv.ID_DDV = ddv.ID_DDV and ca_gecaprod.ID_MOIS <= 5 and ca_gecaprod.ANNEE = 2004 
group by ddv.ID_DDV, ca_gecaprod.DOM_VENTE
 
select ddv.NOM_DDV, ca_gecaprod.DOM_VENTE, sum(ca_gecaprod.CA_MOIS) as CA_CUM_N
from ca_gecaprod,client,vendeur,rdv,ddv
where ca_gecaprod.ID_CLT = client.ID_CLT and client.VL = vendeur.NOM_VENDEUR and vendeur.ID_RDV = rdv.ID_RDV and rdv.ID_DDV = ddv.ID_DDV and ca_gecaprod.ID_MOIS <= 5 and ca_gecaprod.ANNEE = 2005
group by ddv.ID_DDV, ca_gecaprod.DOM_VENTE
 
select ddv.NOM_DDV, ca_gecaprod.DOM_VENTE, sum(ca_gecaprod.CA_MOIS) as CA_CUM_N
from ca_gecaprod,client,vendeur,rdv,ddv
where ca_gecaprod.ID_CLT = client.ID_CLT and client.VL = vendeur.NOM_VENDEUR and vendeur.ID_RDV = rdv.ID_RDV and rdv.ID_DDV = ddv.ID_DDV and ca_gecaprod.ANNEE = 2004
group by ddv.ID_DDV, ca_gecaprod.DOM_VENTE
Merçi d'avance