▲ 7 r/SQL
Best way to update NULL values?
I have data that looks like this:
| Col1 | Col2 | Col3 |
|---|---|---|
| A | Two | 3 |
| B | Two | NULL |
| C | Two | NULL |
| D | Five | NULL |
| E | Five | 6 |
Working in SQL Server, what's the best way to update the NULL values in Col3 to the only non-null value associated with equal values in Col2? e.g. I'd want to update this table to read
| Col1 | Col2 | Col3 |
|---|---|---|
| A | Two | 3 |
| B | Two | 3 |
| C | Two | 3 |
| D | Five | 6 |
| E | Five | 6 |
u/FlucDissThm — 2 days ago