I have one table named tgps, which has six fields and data 
Model ftype serial Date latitude longitude Car B 2142 15/09/2014 S11.59.41.194 W077.07.33.184 Car A 2123 15/09/2014 S12.15.12.245 W076.55.08.194 Truck A 2123 16/09/2014 S13.42.48.122 W071.53.22.081 PickUp C 2111 14/09/2014 S14.36.05.071 W075.11.47.133 PickUp A 2111 15/09/2014 S14.39.51.245 W075.10.00.000 PickUp A 2111 14/09/2014 S14.41.14.040 W075.07.12.245 Truck B 2123 13/09/2014 S14.42.51.092 W075.05.35.133 Car B 2142 14/09/2014 S14.46.14.040 W070.20.03.030 Truck A 2123 13/09/2014 S15.54.53.163 W071.11.21.153 Truck B 2123 16/09/2014 S15.58.40.051 W071.12.48.122 Car A 2123 16/09/2014 S16.18.06.061 W069.16.24.122 Car C 2142 13/09/2014 S16.29.27.092 W071.51.48.122
I want to select the record which has highest value of Date for each Model, ftype and serial, and also need to display the latitude and longitude, so my result should be like this:
Model ftype serial Date latitude longitude Car A 2123 16/09/2014 S16.18.06.061 W069.16.24.122 Car B 2142 15/09/2014 S11.59.41.194 W077.07.33.184 PickUp A 2111 15/09/2014 S14.39.51.245 W075.10.00.000 PickUp C 2111 14/09/2014 S14.36.05.071 W075.11.47.133 Truck A 2123 16/09/2014 S13.42.48.122 W071.53.22.081 Truck B 2123 16/09/2014 S15.58.40.051 W071.12.48.122
This needs an inner join with concatenate fields (Model, ftype and serial), I tried something as:
SELECT model + ftype + serial, date, latitude, longitude
FROM (
    SELECT model + ftype + serial, max(date) 
    FROM tgps group by model, ftype, serial) 
as xw inner join tgps on tgps.model + tgps.ftype + tgps.serial = xw.model + xw.ftype + xw.serial
and tgps.date = xw.max(date) 
but it's not working.
 
     
     
     
     
    