New Zenner
- Join Date:
- Sep 2006
- Posts:
- 51
- Plugin Contributions:
- 0
Can I email only customers that have purchased a particular product?
I'm never really sure if I'm posting in the right thread, but this seems to fit best. I'm trying to build a query that will email only customers that have purchased a particular product. I've seen similar questions where they target specific customer groups, but I've not found one to target a specific item purchased.
What I need then is a proper table to use (TABLE_ORDERS_PRODUCTS ?) and naturally a proper sql. What I have seems to be close, but the numbers don't quite add up. I've based this on the query for customers who have never purchased anything.
SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname
FROM TABLES_ORDERS_PRODUCTS p
JOIN TABLE_ORDERS o ON o.orders_id=p.orders_id
JOIN TABLE_CUSTOMERS c ON c.customers_id=o.customers_id
WHERE products_id =3
```I have to admit, it's been a while since I played with sql coding, so I'm a bit rusty.
Well, as I'm typing this, I realize the different in the count is "DISTINCT", it appears to be coming up fine now, so I'll leave this as something others may find useful.
Ray
RayDube
The Leatherman Place Powered by Zen-Cart!
The Road to Online Success - Traffic Builder - Web Directory - Web Hosting