I am trying to come up with a query to give me the following output (attached image)
This is a chart of fuel pump readings from a 10-day period;
For example, the 802.0 gallons shown here is the sum of four different pumps found by subtracting consecutive day's readings.
This is a delta or change between days readings.
Can anyone tell me how I can calculate these readings and display them in a chart like the attached image?
I have something liike-
pump 1 starting inv.- 1000 ending 200
pump 2 starting inv.- 1000 ending 200
pump 3 starting inv.- 1000 ending 200
pump 4 starting inv.- 1000 ending 202
Thus - when i sum them I get the 802.0 gallons that i need in the chart.
What kind of sql would i use to get the sum of these differences?