Jump to content

Edit History

victorweb

victorweb

SELECT C.firstname, C.lastname, C.email , SUM(OD.total_price_tax_incl) as pvp 
FROM ps_customer C 
INNER JOIN ps_orders O on C.id_customer = O.id_customer
INNER JOIN ps_order_detail OD on O.id_order = OD.id_order
INNER JOIN ps_category_product CP ON CP.id_product = OD.product_id
WHERE CP.id_category = X
GROUP BY C.email
ORDER BY pvp desc

 

En una determinada marca:

SELECT C.email , CAST(SUM(OD.total_price_tax_incl) as decimal(8,2)) as pvp
FROM ps_customer C 
INNER JOIN ps_orders O on C.id_customer = O.id_customer
INNER JOIN ps_order_detail OD on O.id_order = OD.id_order
INNER JOIN ps_product P ON P.id_product = OD.product_id
WHERE P.id_manufacturer = X
GROUP BY C.email
ORDER BY pvp desc

 

victorweb

victorweb

¿Alguien tiene una consulta similar?

 

SELECT C.firstname, C.lastname, C.email , SUM(OD.unit_price_tax_incl) as tasas_include, SUM(OD.unit_price_tax_excl) as tasas_excluidas FROM ps_customer C 
INNER JOIN ps_orders O on C.id_customer = O.id_customer
INNER JOIN ps_order_detail OD on O.id_order = OD.id_order
INNER JOIN ps_category_product CP ON CP.id_product = OD.product_id
WHERE CP.id_category = X
GROUP BY C.email
ORDER BY tasas_include desc

victorweb

victorweb

¿ Alguien tiene realizada una consulta similar? pensaba que podría utlizar OD.category_default como where pero no es esa la categoria a la que pertenece el producto no ?? 

SELECT C.email FROM ps_customer C 
INNER JOIN ps_orders O on C.id_customer = O.id_customer
INNER JOIN ps_order_detail OD on O.id_order = OD.id_order
WHERE OD.product_id =3

 

esta seria para saber quien ha comprado un determinado producto

victorweb

victorweb

¿ Alguien tiene realizada una consulta similar? pensaba que podría utlizar OD.category_default como where pero no es esa la categoria a la que pertenece el producto no ?? 

SELECT C.email FROM ps_customer C 
INNER JOIN ps_orders O on C.id_customer = O.id_customer
INNER JOIN ps_order_detail OD on O.id_order = OD.id_order
WHERE OD.product_id =3

×
×
  • Create New...