I am trying to write a query that will do the following.
I have a table with seperate sales order lines on it. Each line details the customer, product sold, the price sold at, and the date of the sale.
I am trying to establish for each product code, what the last price we sold it for was for each separate customer.
For example using my input below I would expect Product code ABC to return '10' for Brian, '20' for Gary, and '50 for Sam.
Below is complete set of results I would expect for all product codes.