Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Determining customers that have purchased an item


perkinsr

Recommended Posts

Hi,

 

I am desperately trying to figure out how you can get the system to report on the details of all the customers that have purchased an item. If you went to an individual customer it can show all items they have purchased but you can't seem to go to an item and find out all the customers who have purchased that item.

 

Does that make sense?

 

Any help on how I can product this report or an SQL command I could then incorporate into a contrib perhaps?

Link to comment
Share on other sites

SELECT 
 c.customers_firstname, c.customers_lastname, c.customers_email_address 
FROM
 customers c, orders o, orders_products op
WHERE
 c.customers_id = o.customers_id and o.orders_id = op.orders_id and op.products_id = '1';

Replace 1 with the actual product_id. Replace the field names from the second line with the ones that you need. Note: most of the fields that you will want will be in the orders table. I just used the customers table to demonstrate it.

 

Hth,

Matt

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...