MySQL : mémo perso : Requête qui sélectionne tous les clients ayant choisi une formule surprimée

SELECT IP.ID AS IDPROPOSANT,
IP.NOM AS NOM,IP.PRENOM AS PRENOM,
IE.ID AS IDEMPRUNT,
IEFG.SURMORTALITE AS SURMORTALITE,
SP.DESCRIPTION AS PRODUIT,SF.DESCRIPTION AS FORMULE
FROM INTERNETPROPOSANT IP
JOIN INTERNETEMPRUNT IE
ON IE.IDINTERNETPROPOSANT=IP.ID
JOIN INTERNETEMPRUNTDECISIONMEDICALE IED
ON IE.ID=IED.IDINTERNETEMPRUNT
JOIN INTERNETEMPRUNTFORMULE IEF
ON IEF.IDINTERNETEMPRUNTDECISIONMEDICALE=IED.ID
JOIN INTERNETEMPRUNTFORMULEGARANTIE IEFG
ON IEFG.IDINTERNETEMPRUNTFORMULE=IEF.ID
JOIN SRCPRODUIT SP
ON SP.ID=IE.IDSRCPRODUITCHOISI
JOIN SRCFORMULE SF
ON SF.ID=IE.IDSRCFORMULECHOISIE
WHERE IEFG.SURMORTALITE>0
AND IE.NO_CONTRAT IS NOT NULL
AND IE.NO_CONTRAT<>""
AND IP.IDPARTENAIRE=578
AND IE.IDSRCFORMULECHOISIE=IEF.IDSRCFORMULE
GROUP BY IP.ID, IP.NOM, IP.PRENOM, IE.ID,
IEFG.SURMORTALITE, SP.DESCRIPTION, SF.DESCRIPTION;

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.