Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-01-21 : 08:48:43
|
| assim writes "Hi Guys,I am trying to check if a figure(taken from another table) is equal to the sum of all combinations of a column in a table.E.g. figure is 10 , table to check:-Id Value (could be any number)1 22 53 14 4 So want to check all combinations until i find a match and stop or keep looking until all combinations checked. i.e. 2,5,1,4,2+5,2+5+1,2+5+1+4,2+1,2+1+4,2+5+4 etcIn this case there is a match - 5+1+4 = 10This is the simple problem, but i could apply the solution to loop through a number of total figures and check for matching combo's as i am able to identify all rows that can be combined just not sure how to get all combinations and speed will be an issue. - Over to you. Many Thanks." |
|
|
|
|
|