c# - T-SQL Find when a amount has reached a set value -
i have table data like: id amount status 1 15.00 paid 2 3.00 paid 3 10.00 awaiting 4 12.00 awaiting the system looks @ table see if customer has paid enough subscription. uses table record payments. once day need see if customer has met requirement. the solution looks nothing above table more complex, issue remain same , can broken down this. i need find way add amounts up, when amount goes on 20, change data in table follows: id amount status 1 15.00 paid 2 3.00 paid 3 2.00 paid <= customer has reached payment level 4 12.00 cancelled <= subsequent payment cancelled 5 8.00 bforward <= money brought forward currently using cursor, performance bad, expected. does know of better way? generates desired results. not sure why want update original data (assuming transnational data) declare @table table (id int,amount money,status varchar(50)) insert @table values (1,15.00,'p...