Code :
SELECT numeroDeSerie, EXTRACT(MONTH FROM debutLocation) AS mois_0, EXTRACT(YEAR FROM debutLocation) AS annee_0, (SELECT equib FROM equib WHERE mois = mois_0 AND annee = annee_0) AS equib_0, (SELECT ichhts FROM ichhts WHERE mois = mois_0 AND annee = annee_0) AS ichhts _0, (SELECT equib FROM equib WHERE mois = mois_0 AND annee = annee_0 + 1 ) AS equib_1, (SELECT ichhts FROM ichhts WHERE mois = mois_0 AND annee = annee_0 + 1) AS ichhts _1, (0.4*(equib_1/equib_0)+(0.6*(ichtts_1/ichtts_0)) AS resultat FROM TABLE contrat WHERE numeroDeSerie = ‘XXXX’
|