Ok SQL and Oracle gurus I have a somewhat complicated query that I'm trying to build.
Here is my current query:
select distinct person_info.person_name
table2.value,
table3.value,
table4.value,
table5.value
from person_info
left join table2 on table2.person_name=person_info.person_name
left join table3 on table3.person_name=person_info.person_name
left join table4 on table4.person_name=person_info.person_name
left join table5 on table5.person_name=person_info.person_name;
The primary key for every table is both the person_name
and a timestamp
. Now my problem is that if multiple instances of the same person_name
exist in a table then I only want to left join
on the most recent one. Does anyone know how to add this behavior to this query? I am using Oracle.
Thanks!