Ini dia, ini harus dilakukan. Beri tahu saya jika Anda memiliki pertanyaan.
SELECT
TBL.ID,
TBL.EXDATE
FROM
(
SELECT
T1.ID,
T2.EXDATE,
ROW_NUMBER() OVER(PARTITION BY T1.PID ORDER BY T2.EXDATE DESC) AS 'RN'
FROM
Table1 T1
INNER JOIN Table2 T2
ON T1.EXID = T2.EXID
) TBL
WHERE
TBL.RN = 1