I need to understand the way previous values work in the same pattern as in the attached database. This database is a sample i downloaded over the internet while i was looking for my problem, but I'm unable to understand how below query is working in this database even after spending a full hour.
SELECT SpeedoEnd FROM VehicleMiles AS Alias WHERE DorDate = (SELECT Max(DorDate) FROM VehicleMiles AS Alias2 WHERE Alias2.DorDate < VehicleMiles.DorDate AND Alias2.CarNum = VehicleMiles.CarNum) AND Alias.CarNum = VehicleMiles.CarNum
Sorry I don't have a reference to owner of this sample DB, or I would have ask him directly.
Thanks.
SELECT SpeedoEnd FROM VehicleMiles AS Alias WHERE DorDate = (SELECT Max(DorDate) FROM VehicleMiles AS Alias2 WHERE Alias2.DorDate < VehicleMiles.DorDate AND Alias2.CarNum = VehicleMiles.CarNum) AND Alias.CarNum = VehicleMiles.CarNum
Sorry I don't have a reference to owner of this sample DB, or I would have ask him directly.
Thanks.