Public feed #892536

Someone

public sql v1 · immutable
Raw Edit
·published 2008-02-05 14:55 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_finFROM commande c, affaireLEFT JOIN societe ON affaire.id_societe = societe.id_societeLEFT JOIN contact ON contact.id_contact = societe.id_contact_facturationWHERE c.id_affaire = affaire.id_affaireAND c.etat != 'annulee'GROUP BY id_commande, c.dateHAVING '2008-03-05'BETWEEN c.dateAND date_fin