Need to find the most recent row for each student

I was tasked with finding the enrollment status for each status for the past 3 years. some students have more that 4 records. I am trying to exclude graduated students. Any help would be appreciated. here is my code.

select distinct a.People_code_id, p.last_name,p.first_name,left(a.ADMIT_DATE,11) as "Admit Date",
a.ENROLL_SEPARATION,s.last_year,s.last_term,a.graduated,a.GRADUATED_YEAR,pp.PhoneNumber
from academic A
left join people p on p.people_code_id=a.PEOPLE_CODE_ID
left join transcriptdetail T on t.PEOPLE_CODE_ID = a.PEOPLE_CODE_ID
left join student s on s.people_code_id=a.PEOPLE_CODE_ID
left join personphone pp on pp.personid=p.PersonId
where A.academic_year >= '2019' and A.GRADUATED ='N' and
CREDITS > 0 and PRIMARY_FLAG='Y' and ACADEMIC_FLAG='Y' order by LAST_NAME

without any context to any of these tables, it's difficult to provide any help. Can you provide DDL, sample data and expected results and we can help. Note that the sample data doesn't need to be real data, just representative of what you're dealing with