SELECT MIN(id), MAX(id) FROM tabla
BEWERKEN: Als u de waarden van de rij moet ophalen, kunt u dit doen:
SELECT *
FROM TABLA AS a, (SELECT MIN(id) AS mini,
MAX(id) AS maxi
FROM TABLA) AS m
WHERE m.maxi = a.id
OR m.mini = a.id;