In SQL find the combination of rows whose sum add up to a specific amount (or amt in other table)
- by SamH
Table_1
D_ID Integer
Deposit_amt integer
Table_2
Total_ID
Total_amt integer
Is it possible to write a select statement to find all the rows in Table_1 whose Deposit_amt sum to the Total_amt in Table_2. There are multiple rows in both tables.
Say the first row in Table_2 has a Total_amt=100. I would want to know that in Table_1 the…