I want to contact my users via email using my database. I want to make sure that I don't accidentally contact the same user twice. For that, I have a table that tracks who got contacted and when.
When I do my MYSQL query I want to select emails from the the email
table and make sure none of those entries exists in the contacted
table.
To phrase it in a sentence: select email from Email_Table if they are not in Contacted_Table
Perhaps there is a completely different approach. I am open to all suggestions :)Thank you :)
If you consider an inner join as the rows of two tables that meet a certain condition, then the opposite would be the rows in either table that don't.
The biggest difference between an INNER JOIN and an OUTER JOIN is that the inner join will keep only the information from both tables that's related to each other (in the resulting table). An Outer Join, on the other hand, will also keep information that is not related to the other table in the resulting table.
Oracle recommend you use ANSI joins, at least for outer joins.
Different Types of SQL JOINs Here are the different types of the JOINs in SQL: (INNER) JOIN : Returns records that have matching values in both tables. LEFT (OUTER) JOIN : Returns all records from the left table, and the matched records from the right table.
Try this
SELECT email FROM email_table e LEFT JOIN contacted_table c ON e.email = c.email WHERE c.email IS NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With