Jump to content
kieranbold

RE: How to find all customers who bought a specific product

Recommended Posts

In response to this thread: https://www.prestashop.com/forums/topic/324997-solved-how-to-find-all-customers-who-bought-a-specific-product/

 

I'm trying to execute this on SQL Manager and I get:

 

The "id_customerINNER" attribute does not exist in the "ps_orders" table.

 

CODE:

 

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 IN (3,45,47,94,102)

 

OR

 

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

 

Even with changing the last line of each code statements.

 

How can I resolve this?

 

Thanks

Edited by kieranbold (see edit history)

Share this post


Link to post
Share on other sites

Hi kieranbold,

 

I use this and it works. Problem of parenthesis !!

 

SELECT * FROM ps_customer c
INNER JOIN ps_orders o ON (c.id_customer=o.id_customer)
INNER JOIN ps_order_detail od ON(od.id_order=o.id_order)
WHERE od.product_id=100

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More