SELECT t.id_passport, t.applicant_id, t.pass_no, a.max_date
FROM passport t INNER JOIN
(SELECT id_passport, applicant_id, MAX(pass_expiry) AS max_date
FROM passport
WHERE (applicant_id = @applicant_id)) a ON a.applicant_id = t.applicant_id AND a.max_date = t.pass_expiry
No comments:
Post a Comment