Public feed #892529

Someone

public sql v1 · immutable
Raw Edit
·published 2008-02-05 14:50 UTC
rendered paste body
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, affaireWHERE c.id_affaire = affaire.id_affaireAND c.etat != 'annulee'left join societe on  affaire.id_societe=societe.id_societeleft join contact on contact.id_contact=societe.id_contact_facturationGROUP BY id_commande, c.dateHAVING '2008-03-05' BETWEEN c.date AND date_fin