Jump to content

Edit History

JulienPct

JulienPct

Cette requête semble mieux mais je ne suis pas sûr que cela règlera le problème. Qu'en est-il ?

SELECT 
product_id AS `ID`, 
od.product_name AS `Nom du produit`, 
od.product_quantity AS `Qté` , 
DATE_FORMAT(tco.ordered_datetime, "%W %e %M %Y") AS `Date de la réservation`, DATEDIFF(tco.ordered_datetime, now() ) as `Dans x jour`, 
cu.firstname AS `Prénom`, 
cu.lastname AS `Nom`, 
cu.email, 
cu.id_default_group AS `Groupe : 3 Client, 4 Adhérent` 
FROM `ps_order_detail` od 
LEFT JOIN `ps_product` p ON p.id_product = od.product_id AND p.id_product != 1
LEFT JOIN `ps_terracalendar_order` tco ON (tco.id_product = p.id_product AND tco.id_order = od.id_order AND tco.ordered_datetime IS NOT NULL) 
LEFT JOIN `ps_orders` o ON o.id_order = tco.id_order
LEFT JOIN `ps_customer` cu ON cu.id_customer = o.id_customer
ORDER BY tco.ordered_datetime;

 

JulienPct

JulienPct

Cette requête semble mieux mais je ne pense pas que cela règlera le problème ? Qu'en est-il ?

SELECT 
product_id AS `ID`, 
od.product_name AS `Nom du produit`, 
od.product_quantity AS `Qté` , 
DATE_FORMAT(tco.ordered_datetime, "%W %e %M %Y") AS `Date de la réservation`, DATEDIFF(tco.ordered_datetime, now() ) as `Dans x jour`, 
cu.firstname AS `Prénom`, 
cu.lastname AS `Nom`, 
cu.email, 
cu.id_default_group AS `Groupe : 3 Client, 4 Adhérent` 
FROM `ps_order_detail` od 
LEFT JOIN `ps_product` p ON p.id_product = od.product_id AND p.id_product != 1
LEFT JOIN `ps_terracalendar_order` tco ON (tco.id_product = p.id_product AND tco.id_order = od.id_order AND tco.ordered_datetime IS NOT NULL) 
LEFT JOIN `ps_orders` o ON o.id_order = tco.id_order
LEFT JOIN `ps_customer` cu ON cu.id_customer = o.id_customer
ORDER BY tco.ordered_datetime;

 

JulienPct

JulienPct

Cette requête semble mieux mais je ne pense pas que cela règlera le problème de doublon

SELECT 
product_id AS `ID`, 
od.product_name AS `Nom du produit`, 
od.product_quantity AS `Qté` , 
DATE_FORMAT(tco.ordered_datetime, "%W %e %M %Y") AS `Date de la réservation`, DATEDIFF(tco.ordered_datetime, now() ) as `Dans x jour`, 
cu.firstname AS `Prénom`, 
cu.lastname AS `Nom`, 
cu.email, 
cu.id_default_group AS `Groupe : 3 Client, 4 Adhérent` 
FROM `ps_order_detail` od 
LEFT JOIN `ps_product` p ON p.id_product = od.product_id AND p.id_product != 1
LEFT JOIN `ps_terracalendar_order` tco ON (tco.id_product = p.id_product AND tco.id_order = od.id_order AND tco.ordered_datetime IS NOT NULL) 
LEFT JOIN `ps_orders` o ON o.id_order = tco.id_order
LEFT JOIN `ps_customer` cu ON cu.id_customer = o.id_customer
ORDER BY tco.ordered_datetime;

 

×
×
  • Create New...