How to get the ID of Query
Keep in mind that you could get more than 1 row just in case there are two or more records with the same DateGps.

SELECT lp.Id
FROM   LastPosition lp
JOIN   (SELECT  Serial,
                MAX(DateGps) AS maxi
        FROM    LastPosition
        GROUP BY Serial) t1
ON      lp.Serial = t1.Serial
AND     lp.DateGps = t1.maxi;