View Full Version : Running total?

08-21-2007, 09:48 PM
I would like to keep a running total of miles used on a truck. The user will be allowed to enter the total miles on the truck after every use but I want to be able to keep the total miles updating after every user submits their total how would I go about doing this.

08-21-2007, 10:23 PM
That's a rather general question.
You'd store the individual miles in a database, have an app to interface to the database, and have the query do a SUM on the column.

Or any of the other 16 ways you could do this.

08-22-2007, 12:27 AM
If they're just entering the total miles on the truck after each use it would automatically have the right total miles...
Are you wanting to give them a total of how many miles in that use?
You could store the miles in a link table


To get the total miles for an individual trip just subtract the new figure from the last one in the database. You could also track the number of miles between any 2 dates.