From a table of sales records, I need to select the most recent transactions by customer where the sum of those transactions is greater than $500; BUT, only enough records to meet the minimum sum requirement- not all of them.
So if a customer spent $150 once a month for the last year, I want to ONLY select the most recent 4 records...
If he spent $50 once a month, I'd need the most recent 10 records...
Ideas?
Thanks in advance...
-Allen M.
So if a customer spent $150 once a month for the last year, I want to ONLY select the most recent 4 records...
If he spent $50 once a month, I'd need the most recent 10 records...
Ideas?
Thanks in advance...
-Allen M.