Start med dette:
select StudentId, max(DateApproved)
from tbl
group by StudentId
Integrer det derefter i hovedforespørgslen:
select *
from tbl
where (StudentId, DateApproved) in
(
select StudentId, max(DateApproved)
from tbl
group by StudentId
)
Du kan også bruge denne:
select *
from tbl
join (select StudentId, max(DateApproved) as DateApproved
from tbl
group by StudentId)
using (StudentId, DateApproved)
Men jeg foretrækker tupeltest, det er på den måde pænere
Live test:http://www.sqlfiddle.com/#!2/771b8/ 5