Hi All,
I have some experience with SQL, but this one stumps me. I have
created a table to track my gas purchases (see below). But, each time
I enter a new purchase, I'm manually calculating gas mileage as
(gallons_purchased / mileage_at_purchase[n] -
mileage_at_purchase[n-1]). I can't figure out I can easilly get
gallons_purchased and mileage_at_purchase into a SQL statement, but how
do i reference the last entry's mileage_at_purchase in my SQL statement
so I can make the calculation?
prikey mileage_at_purchase gallons_purchased gas_mileage*
---------------------------------------------------------------
1 176 3.447 51.06
2 329 3.167 48.31
3 506 3.027 58.47
4 650 3.126 46.07
*I want to calculate this column.