Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. $sql = "select
  2. u.lastname as nomBenef,
  3. u.firstname as prenomBenef,
  4. a.adr1 as adresse,
  5. c.zipcode as zipcode,
  6. c.name as ville,
  7. r.id_type as idTypeRetour,
  8. r.id_organisme as organismeRetour,
  9. r.createAt as dateRetour,
  10. r.code as codeRetour,
  11. r.id_address as addressRetour,
  12. r.comment as commentRetour,
  13. rs.name as etatRetour,
  14. ao.number as numOrder,
  15. p.name as nameProduct,
  16. lr.id_motif as motifLigneRetour,
  17. ai.reference as sct,
  18. lr.sct_echange as newSctLigneRetour,
  19. mvp.size_value as tailleProduct,
  20. if (mvp.conf_id = 1, mvp.conf_value, null) as conformationProduct,
  21. mvp2.size_value as newTailleProduct,
  22. if (mvp2.conf_id = 1, mvp2.conf_value, null) as newConformationProduct,
  23. rm.name as ligneRetourMotif,
  24. rt.name as retourType
  25. from retour r
  26. join ligneretour lr on lr.id_retour = r.id
  27. join ligne_preparation lp on lp.id_ligne_preparation = lr.id_ligne_preparation
  28. join bon_preparation bp on bp.id_bon_preparation = lp.id_bon_preparation
  29. join anorder ao on ao.id = bp.id_commande
  30. join anorderitem ai on ai.order_id = ao.id and ai.reference = lp.id_stock_sct
  31. join product p on p.id = ai.product_id
  32. left join measuretypevalueproduct mvp on lr.sct = mvp.reference
  33. left join measuretypevalueproduct mvp2 on lr.sct_echange = mvp2.reference
  34. join retourstatus rs on r.id_status = rs.id
  35. left join retourmotif rm on lr.id_motif = rm.id
  36. join retourtype rt on r.id_type = rt.id
  37. join address a on r.id_address = a.id
  38. join commune c on a.commune_id = c.id
  39. join user u on ao.recipient_id = u.id";
  40. $sql .= $where;
  41. $sql .= " and r.id_type != :vrac
  42. group by lp.id_ligne_preparation
  43. order by r.createAt DESC";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement