salut tout le monde

je veux que les agents qui ont pris congé en 2013 par exemple 1154 a pris 10 alors reliquat égale 20 mais dans l'exercice 2012 reliquat 30 car il a pas pris congé

table récap

matricule , pris , exercice
1154 10 2013

table agent 2013

matricule nom
1154 david
4444 mino
4687 mour

problème que si je veux afficher reliquat des agent en 2012 alors agent 1154 n’affiche pas

le résultat de la requête exercice 2012 ça donne
4444 30
4687 30
mais n'affiche pas agent 1154 qui a aussi 30
je vous montre ma requête
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
16
17
18
19
20
 
SELECT h.agt_matricule,
       h.agt_nom ,
       CASE
         WHEN 30 - SUM(t.pris) IS NULL THEN
          30
         ELSE
          30 - SUM(t.pris)
       end david
   FROM récap t, h_agent h, h_fonctions, h_structures
   WHERE t.matricule(+) = h.agt_matricule
   and h.agt_cstruct = h_structures.str_cstruct
   and h.agt_cfonction = h_fonctions.fct_cfonction
   and h.agt_oper = '1'
   AND (t.exercice = 2012 OR t.exercice IS NULL)
   and h.agt_matricule='11900F'
   GROUP BY h.agt_matricule,
          h.agt_nom,
         t.exercice
          HAVING 30-SUM(t.pris) > 0
merci d'avance