A solution to last week's challenge can be found here.
This week's challenge was submitted by @JosephSerpis - Thank you for your submission!
Everyone loves a good invoice! There’s just something about seeing the amount you paid for each item and finding that everything is as it should be, adding up to the total amount. And for the most part invoices are created by automated processes which reduce the chance of errors appearing (unless someone entered the wrong items). But what if something went wrong…
For this week’s challenge, pretend you are a business analyst for a service provider which offers a number of services. You are attempting to report the services delivered for last month. Due to data limitations of your database the data comes in a unique way which you need to calculate the rolling sales in order to work out the total of services provided. The total sales are all the sales between (and including) each matching pair of IDs. In other words, you need to find the total of all of the sales for the records beginning with a given ID through to the corresponding ID, making sure to include all records between your pair of matching IDs.