Select pea.email_address_id, papf.person_id, pea.email_type,pea.email_address,
case when pea.email_address_id = papf.primary_email_id
else 'N' end primary_email_flag
FROM per_email_Addresses pea, per_All_people_f papf
where pea.person_id = papf.person_id
AND TRUNC(SYSDATE) BETWEEN papf.effective_start_date AND papf.effective_end_date
I hope this blog post was helpful for you. If you have any questions or feedback, please leave a comment below.