I have the following data in the table SALES:
BillItemID CustID BillDate Item BillAmt
1001 1 09-10-01 Suit $50.00
1002 1 09-10-01 Shirt $20.00
1003 1 09-10-01 Pants $20.00
1004 1 09-10-01 Tie $5.00
1005 1 09-01-10 Tie $5.00
Customer #1 now presents a payment of $75.00. I want to locate any set of rows (I don't care which set) such that SUM(BillAmt) of the selected rows totals $75.00. Can anyone suggest an SQL query that will do this?
I'm using an obscure niche database called R:Base (okay, who here is old?) which supports much of SQL-92 syntax and offers stored procedures. I should be able to shoe-horn any SQL-92 answer that doesn't use vendor-specific extensions into my application.