Mileage Query

  • Thread starter Thread starter schongresh
  • Start date Start date
S

schongresh

I am setting up a database that will take fuel log records and
calculate daily mileage, usage, gas mileage, etc. The record will have
Date-Truck#-Mileage(at time of fueling)-Amounts(Gallons)-Fuel Price.
In order to Query the database to find miles driven in a day for a
given truck- I need to get the Truck's previous days mileage to do the
math. What can I enter in the query design that will return the last
mileage entry and the one previous for the same truck? Or can a field
in the database automatically insert the previous recorded mileage for
a given truck to become "beginning mileage" and the current mileage
become "ending mileage". Either way I am not sure how to achieve this.
Any help would be appreciated.
 
You use two instance of the same table in the query. When you do that Access
adds a sufix of '_1' to the table name. Join the two table on the TruckID.
 
Back
Top