Skip to main content
2 of 2
deleted 42 characters in body

Get count of contacts with email addresses that matches other contacts in same tables

I have a contacts table that is like this:

|id|first_name|last_name|date_entered|

then, I have a table that stores the email addresses like this:

|id|email_address|

I then have a relational table that joins the two tables above together like this:

|id|contact_id|email_id|

What I am trying to figure out is, how do I get a count of all new contacts that has been entered in between 2023-02-10 and 2023-02-13 but only the contacts that have matching emails?

For example, a new contact is entered in the db with the email of [email protected]. A few days later, that same contact comes back and is entered in by another person but with the same email address of [email protected].

I am building a report of "New vs Returning Customers" and we use their email to identify a customer that is returning. So, I am needing to be able to list a count of all customers in the database with the same email that is > 1. Is this possible with MySQL? Thanks!