Mulailah dengan ini:
select StudentId, max(DateApproved)
from tbl
group by StudentId
Kemudian integrasikan itu ke kueri utama:
select *
from tbl
where (StudentId, DateApproved) in
(
select StudentId, max(DateApproved)
from tbl
group by StudentId
)
Anda juga dapat menggunakan ini:
select *
from tbl
join (select StudentId, max(DateApproved) as DateApproved
from tbl
group by StudentId)
using (StudentId, DateApproved)
Tapi saya lebih suka pengujian Tuple, caranya lebih rapi
Tes langsung:http://www.sqlfiddle.com/#!2/771b8/ 5