这只是一个例子,我正在做类似的事情,它将获取数千条记录。
SELECT * FROM
(SELECT * FROM zoodb) As TblA
INNER JOIN
(SELECT animal_ID, Max(checkup_year) AS latest_checkup FROM TblA GROUP BY animal_ID) as TblB
ON (TblA.animal_ID = TblB.animal_ID) AND (TblA.checkup_year = TblB.latest_checkup)
基本上在这,我想只抓取最近检查年份的记录