MSSQL Update Trick
So today I found a neat trick (that was intuitive but not obvious, at least to me and my google search for “SQL update set column = column”) was that you can set one column to be relative to anther column in the same table.
So in this example my table has 2 columns: buy and sell, initially I have set both to the same value but now I want to add 15% margin onto this. The solution is very simple:
UPDATE table SET sell = buy * 1.15
And like magic all the sell values in the table are 15% higher than the buy price.