AnsweredAssumed Answered

Three table join?

Question asked by ArnorKristjansson on May 2, 2012
Latest reply on May 4, 2012 by philmodjunk

Title

Three table join?

Post

I wasn't sure what I should have in the title :-P

 

I'm looking for a way to send an email to all customers that want an email for certain products.

 

I have three tables

Customers:

ID (number)

Name (text)

email Address (text)

SendEmail (number/boolean)

etc

 

Products:

CustID -> Customers(ID)

Product name (text) <-values from another table

 

Emails:

EmailID (number)

Subject (text)

Body (text)

 

The story is this: I have customers that I want to send an email to. Some customers have some products that I want to contact them about from time to time. F.x. if an HP 8500 toner comes on sale I want to be able to email the customers that have bought that printer _if_ the email checkbox is checked.

 

The data would look like this:

Customers:

ID "1"

Name "Splurge Inc."

email Address "splurge@example.com"

SendEmail "1"

etc

 

Products:

CustID "1"

Product name "HP Color LaserJet 8500"

 

Emails:

EmailID "1"

Subject "HP Color LaserJet 8500 toner sale"

Body "Foo bar"

 

What I don't understand is how I would perform a find from the Email table/database so that an email would only be sent for certain Customers (the one where SendEmail=1) and certain products

Outcomes