I have a table similar to the one below with customers, products, and purchase date. I am trying to get a list of customers and their 3 most recently purchased DISTINCT products. I want to use purchase date as a means of ordering the results, but I don't want to see duplicate product IDs.
Customer | Product | PurchaseDate |
---|---|---|
1 | a | 2020-12-5 |
2 | b | 2020-12-5 |
1 | a | 2020-12-4 |
2 | a | 2020-12-3 |
1 | b | 2020-12-2 |
2 | b | 2020-12-1 |
1 | c | 2020-11-30 |
1 | d | 2020-11-29 |
2 | b | 2020-11-28 |