I wanted to calculate the sum from a set of values - contributing to maximum possible sum value less than an absolute number in SQL.
I have a set of 5 values : 800,350,260,250,300
I want to sum up the values from the above set to get a value closest to 1000 not exceeding it.
like 350+260+300 will sum upto 910 which is the best max possible value. I want to put this in an algorithm