I have a SQL Server table which holds records for changes in fuel prices. When the fuel price changes and new record is added to the table with the changed date and price. I need to calculate the final total of fuel price between two dates. In this example I want to calculate the total of price between 01/12/2014 and 31/12/2014.
Fuel_Price | Change_Date
------------------------
16.50 | 01-01-2014
17.50 | 05-12-2014
17.25 | 15-12-2014
16.00 | 27-12-2014
Edit:
Total price = 16.50 * 5 (5-12-2014 - 1-12-2014) + 17.50 * 10 + 16 * 12 = 449,5