I have a table that looks like this
Date, Truck, Miles
1/1/2006, 700, 30000
1/15/2006, 700, 30100
1/7/2006, 700, 30050
1/1/2006, 701, 5000
1/17/2006, 701, 5100
1/20/2006, 701, 5200
I need to return the truck number and the miles where the date is the max.
Such as this
Date, Truck, Miles
1/15/2006, 700, 30100
1/20/2006, 701, 5200
It seems very simple. I thought my statement should return miles and truck, group by truck where date is max of date.
If I leave miles out it works, if I put miles in it returns every record.
Here is my statement.
SELECT Gas_Tickets_Tbl.Truck, Gas_Tickets_Tbl.Miles
FROM Gas_Tickets_Tbl
GROUP BY Gas_Tickets_Tbl.Truck, Gas_Tickets_Tbl.Miles;
Thanks
Brandon