Jump to content

Requête SQL commande Clients


Recommended Posts

  • 4 weeks later...
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

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 by JulienPct (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...