perkinsr Posted December 19, 2003 Share Posted December 19, 2003 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 More sharing options...
Guest Posted December 19, 2003 Share Posted December 19, 2003 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 More sharing options...
perkinsr Posted December 19, 2003 Author Share Posted December 19, 2003 Thanks a lot for that Mat gives me a base to work on :) Happy Christmas Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.