I’ve got a SQL table (Email_Campaigns) with a master list of campaigns we’ve run:
Name DateSent
Campaign01 01/01/2011
Campaign02 01/15/2011
..
Campaign40 10/01/2011
I’ve got a list of customers (Email_Received) with their membership numbers and the campaigns they’ve received:
PK MembershipNo CampaignName
1 123456 Campaign01
2 123456 Campaign02
3 987654 Campaign05
4 111111 Campaign10
I’ve also got a master list of customer MembershipNo’s (Customers)
Question: How do I write a query to list each campaign and count the number of customers who DID NOT receive that e-mail? For example (‘Received’ column is only shown here for reference and isn’t imperative as I know how to calculate that):
Name Received DidNotReceive
Campaign01 1000 9000
Campaign02 3000 7000
..
Campaign40 100 9900
Here’s one standard SQL way to write this: