I have the table
+---------------------+
| ID | Code | Amount -|
+---------------------+
| 1 | 101 | 1.2 |
| 1 | 102 | 1.3 |
| 1 | 103 | 1.3 |
| 1 | 104 | 1.4 |
| 1 | 105 | 1.2 |
| 2 | 101 | 1.5 |
| 2 | 102 | 1.4 |
| 2 | 103 | 1.3 |
| 2 | 104 | 1.1 |
| 2 | 105 | 1.0 |
+---------------------+
What I am trying to do is change the amount column for each ID which is not the code 101 to the value in amount from code 101
So my output should be like this.
+---------------------+
| ID | Code | Amount -|
+---------------------+
| 1 | 101 | 1.2 |
| 1 | 102 | 1.2 |
| 1 | 103 | 1.2 |
| 1 | 104 | 1.2 |
| 1 | 105 | 1.2 |
| 2 | 101 | 1.5 |
| 2 | 102 | 1.5 |
| 2 | 103 | 1.5 |
| 2 | 104 | 1.5 |
| 2 | 105 | 1.5 |
+---------------------+
This is clearly a simplified table to show what I need as the row count today is over 100,000 but will change everyday.
I have tried to use a cursor but it is very slow. Is there anyway to do this?
Thanks