Problème requete left join
Bonjour à tous,
voici mon problème:
je dois sortir une requete qui me donne le nombre de facture sur base d'un croisement d'info de la table client. J'ai fais ceci qui fonctionne très bien:
Code:
1 2 3 4 5 6 7 8 9 10
|
select SIH.SIVTYP_0,ml6220.LANMES_0, ml406.LANMES_0, count(*) as result from RES.SINVOICE SIH
left join RES.BPCUSTOMER BPC on SIH.BPR_0 = BPC.BPCNUM_0
left join RES.SINVOICEV SIV on SIH.NUM_0 = SIV.NUM_0
left join RES.APLSTD ml6220 on (ml6220.LANCHP_0=6220 and ml6220.LAN_0='FRA' and ml6220.LANNUM_0= BPC.YCODIMP_0)
left join RES.APLSTD ml406 on (ml406.LANCHP_0=406 and ml406.LAN_0='FRA' and ml406.LANNUM_0= BPC.INVPER_0)
where SIH.accdat_0 between to_date('20170701','YYYYMMDD') and to_date('20170731','YYYYMMDD') and
BPC.BCGCOD_0 in ('TRD','TRX','TRY') and
SIV.SALFCY_0 in ('WES','CWS','CTS','GTS','GSS','WSS','GDS','CGS')
group by SIH.SIVTYP_0,ml6220.LANMES_0, ml406.LANMES_0 |
cela me donne les infos demandées mais on me demande maintenant que si un croisement possible à un nombre à 0 il doit quand même apparaitre dans le résultat. Je pensais que le left join ferais le boulot mais j'ai du louper quelque chose. Pourriez vous me donner un petit coup de main.
Voici ce que je devrais avoir:
impression |
périodicité |
nombre |
standard |
mois |
10 |
standard |
quinzaine |
0 |
standard |
jour |
5 |
merci du coup de main