This question is for Oracle SQL DEV

What I am trying to accomplish is to pull the top record for each person (last name + First name + Dob), using their most recent travel date. To help illustrate my point, I included a screenshot of two individuals and their travel history. I want my query to pull only one record from each name + dob group using their most recent travel date.

I tried to use the row_number and partition but couldn't gain any traction. Can a more experienced developer/programmer help me?

enter image description here


1 Answer 1


Something like the following (untested) should work:

with partitions as (
    row_number() over (partition by last_name, first_name, dob order by travel_date desc) as r
  from my_table as x
select *
from partitions
where r = 1;
  • Thank you! It worked fine
    – SQLPhan
    Jun 29, 2021 at 12:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.