i’m having a hard time getting the right row from my table.
I’m trying to get some rows by finding emails and i want to get the last email sent to them.
My query is:
select *
from persons p2, (
SELECT p.id,p.name,p.email
FROM persons p, emails e
WHERE p.id = e.person_id
) a
where a.email = p2.email
This query return the list of all the email sent to persons.
Can someone help me with this query, the query need to return list of persons with emails, but each email need to appear one time.
Thanks
Try this variant: