Welcome to WebmasterWorld Guest from 18.104.22.168
Forum Moderators: open
I'm searching for a list of contacts email addresses. The contacts companies have to have an active subscription to product2.
The following query works fine:
SELECT DISTINCT ct.Email
FROM Contacts ct, Companies cp
WHERE ct.CompanyID = cp.ID
AND cp.Subscription & 16
AND cp.SubscriptionExpiry >= NOW()
Subscription bit 16 means they have access to product2.
But product1 and product2 share the same categories. Let's call the column 'Fruit'.
How can I modify the SQL above to weed out the companies who are only subscribed to pear and orange? (If they have a mixture of product1 and product2 fruits then this is ok).
I want to end up with a list of product2 contacts.