Sql query might not be the tool for this? Maybe python?
lst = [25, 75, 100, 175, 180, 100, 200]
import itertools
print("Without replacements:")
for l in range(1,len(lst)+1):
for comb in itertools.combinations(lst,r=l):
if sum(comb) == 500:
print(comb)
@harishgg1
Thanks for the solution, But here i need to find the possibilities in rows and find the combination by summing the values from table2 that matches the total value in table1
to be clear with example
table1
col1
500
Table 2
col1
25
75
100
175
180
100
i need to find out that Which combination of sum will be equals to 500 in table 1
adding to that i need to store the Row numbers of all that we summed to get the total