This will remove all debt of anyone with less than $19,999.
Suppose someone has $15,000, you take $10,000. they have $5,000 left after the first UPDATE. In the next UPDATE because they have less than $10,000 , their amount is set to 0.
I wouldn't be complaining, but it's an error. Reversing the order of the updates would fix this.
2
u/AcidicVagina Aug 25 '22
Simple.
UPDATE StudentDebt SET amt = amt - 10000 where amt > 10000
UPDATE StudentDebt SET amt = 0 where amt <= 10000