1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
CREATE PROCEDURE `Retraites_mensuelles`(IN dateDebut DATE, IN datefin DATE)
NOT DETERMINISTIC
SQL SECURITY INVOKER
COMMENT ''
BEGIN
SELECT ra.`DateRetraite`, ra.`NumDMretraite`, ra.`DateSignature`,
ca.`LibelleCategorie`, gr.`LibelleGrade`, ag.`Nom`, ag.`Prenom`,
ag.`MatriculeSolde`
FROM agents AS ag
INNER JOIN `promotion_agents` AS PA ON PA.`ID` = ag.`ID`
INNER JOIN `grades` AS gr ON gr.`IDgrade` = PA.`IDgrade`
INNER JOIN `categorie` AS ca ON ca.`IDcategorie` = gr.`IDcat`
INNER JOIN `retraite_agents` AS ra ON ra.`ID` = ag.`ID`
WHERE (SELECT COUNT(*) FROM promotion_agents AS PA2
WHERE PA.`ID` = PA2.`ID` AND PA.`DatePromotion` < PA2.`DatePromotion`) < 1 AND
ra.`DateRetraite` BETWEEN datedebut AND datefin;
END; |
Partager