raphael Posted October 21, 2021 Share Posted October 21, 2021 Bonjour, je cherche a faire une requête SQL prestashop 1.7 pour pouvoir Sortir " la liste des clients activé avec la date de leur dernières commandes" merci d'avance pour vos retour Link to comment Share on other sites More sharing options...
JulienPct Posted October 21, 2021 Share Posted October 21, 2021 Bonjour, Quelque chose de ce style ? SELECT o.id_order, o.id_customer, max(o.invoice_date), c.email FROM ps_orders o LEFT JOIN ps_customer c ON c.id_customer = o.id_customer GROUP BY o.id_customer; Link to comment Share on other sites More sharing options...
raphael Posted November 16, 2021 Author Share Posted November 16, 2021 Le 21/10/2021 à 2:37 PM, JulienPct a dit : Bonjour, Quelque chose de ce style ? SELECT o.id_order, o.id_customer, max(o.invoice_date), c.email FROM ps_orders o LEFT JOIN ps_customer c ON c.id_customer = o.id_customer GROUP BY o.id_customer; Oui voila merci c'est parfait Link to comment Share on other sites More sharing options...
raphael Posted November 16, 2021 Author Share Posted November 16, 2021 Bonjour, je coince pour une nouvelle requête stats de vente sur un mois des produits vendu uniquement pour le pays FRANCE Merci d'avance pour votre aide Link to comment Share on other sites More sharing options...
JulienPct Posted November 16, 2021 Share Posted November 16, 2021 (edited) select od.product_id as ProductID, od.product_quantity as Quantité, ppl.name as Nom, ppl.id_shop as Shop, pl.name as Pays, dc.amount as EcoParticipation from ps_order_detail od inner join ps_orders o on (o.id_order = od.id_order and o.invoice_date between '2021-11-16 00:00:00' and '2021-11-16 23:59:59') inner join ps_product_lang ppl on (ppl.id_product = od.product_id and ppl.id_lang = 1 and ppl.id_shop = 1) inner join ps_lang pl on pl.id_lang = ppl.id_lang left join (select od.product_id, sum(od.ecotax * od.product_quantity) as amount from ps_order_detail od group by od.product_id) dc on dc.product_id = od.product_id where pl.iso_code = "fr" group by od.product_id; Normalement cette requête correspond aux besoins Edited November 16, 2021 by JulienPct (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now