SELECT id_commande, c.id_affaire, c.date AS date_debut, contact.email, DATE_ADD( c.date, INTERVAL month( c.date ) + SUM( IF( duree_1 IS NULL , 0, duree_1 ) + IF( duree_2 IS NULL , 0, duree_2 ) + IF( duree_3 IS NULL , 0, duree_3 ) + IF( duree_4 IS NULL , 0, duree_4 ) + IF( duree_5 IS NULL , 0, duree_5 ) ) MONTH ) AS date_fin FROM commande c, affaire LEFT JOIN societe ON affaire.id_societe = societe.id_societe LEFT JOIN contact ON contact.id_contact = societe.id_contact_facturation WHERE c.id_affaire = affaire.id_affaire AND c.etat != 'annulee' GROUP BY id_commande, c.date HAVING '2008-03-05' BETWEEN c.date AND date_fin