SQL query help needed
Two tables, one of customer contact info, one of credit card info (last 4 digits, expiration, associated customer record). More than one credit card can be associated with a customer_id.We've got a script which figures out which customers' cards are going to expire next month, and notifies both them and us. Then the customer can log into his control panel and enter the new card.
The problem with the script is that it mails the customer even if they have both an expired card and a good card associated with their customer_id.
So what I need is the SQL query to generate a list of customer email addresses and names and last four digits associated with all customer records that have all expiring cards. Make sense?
Been struggling with this for a couple days now. Thanks for any help.