...

View Full Version : Running total?



porsche21
08-21-2007, 10: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.

nikkiH
08-21-2007, 11: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.

NancyJ
08-22-2007, 01: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

eg.
truck_id
timestamp
miles

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum