Subtract value to multiple rows - SQL
Well I am stuck at a point where I need to distribute a value across multiple rows. Since I do not know the specific term, I would put it in the form of example below for better understanding: Assuming the value of x to be 20, I need to distribute/subtract it to rows in descending order. TABLE: ID Value1 1 6 2 5 3 4 4 3 5 9 Result should look like: (x=20) ID Value1 Answer 1 6 14 2 5 9 3 4 5 4 3 2 5 9 0 Can anyone just give me an idea how I could go with this? I hope my question is clear enough. If not please let me know. Thanks. Any help would be greatly appreciated. It is perhaps easier to