MySQl - Need to accuire exact data by comparing 2 tables

hi Team,

I need your help in finding a solution for below issue,

i have a scenario where i have to compare 2 tables derive the status,

table 1 :
ID value
1 650

table 2
ID Value
1 50
1 75
1 60
1 450
1 200

here i need to compare the value of 2 table with the ID number to get the value of 650.

Scenario 1: I may get as exact match in table 2 as 650
Scenario 2:i may get exact match in table 2 by summing all the line as 650
Scenario 3:I may get the exact match in table 2 by summing any of the line corresponding to ID 1
here in the above scenario
i need to sum 1st,4th and 5th line to get exact match as 650.

i want help in deriving the 3rd scenario in MYSQL.

what have you tried?

What is the real-world purpose of this? It would have to examine a combinatorial explosion of possibilities.

1 Like

the purpose is this scenario is use for finding the accruals for the Shipment based on the cost estimates available in the table 2.

Sorry!! Mike01 im totally stucked with this.