sql - How to select records present in one table which are not present in another table knowing that records can be kept in multiple fields -


this question might have been asked already, haven't seen it. need quality control purposes. 1 table respondents should send emails to, , other 1 list of respondents have unsubscribed, or have blacklisted.
there possibility respondent can have records in both tables (for example have email in respondents email column, , exact same email in unsubscribers email 2 column etc.)

table respondents:
name
surname
email
email 2
phone
phone 2

table unsubscribers:
name
surname
email
email 2
email 3
email 4
phone

something should it.

select email respondents left join unsubscribers u1 on respondents.email = u1.email join unsubscribers u2 on respondents.email = u2.email2 u1.email null , u2.email2 null

however, try normalize database. in instance add date_unsubscribed field respondents table, makes sort of thing way easier , reduced database complexity , storage requirements.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -