I want everyone in the list of this temporary table and include the email address from this other table; if there is no email, show null. I also want to see their respective language if available; if not, null.
I keep getting a higher number of people which I think are repeats.
SELECT temp.*,
a.email_addr,
a.ibe_3103
FROM cigna_shared.tempoarytable temp
LEFT JOIN (
SELECT DISTINCT poli.account_number,
info.language, em.email_address
FROM policytable poli
LEFT JOIN languagetable info
ON poli.id = info.id
LEFT JOIN emailtable em
ON poli.KEY = em.KEY
) a
ON temp.memberid = a.account_number;
The total amount of people in the temporary table (76,815) and i'm getting 85k back. I can see that there are multiple poli acccount numbers in the poli table, so the email can be linked to 3 poli account numbers. i'm trying to figure out how to make it so that it all totals 76,815 with the added email address and language.
Where am I causing the replication?