Compare the contents of a single column and sync rows in that colum This is SQL Server - I have 3 rows of data in a single table based on location I want the data for a single field to match in all three locations e.g I have parts in three locations, location 1, 2, and 3 but the price for the part is different in each of the three locations, I would like to sync the price for all three locations

This is table 1 - fields include item number, location, price. e.g

item    loc.    price
123     1       0.1
123     2       0.2
123     3       0.3


My desired outcome is that location 2 and 3 will have the same price as location 1.
Is this what you're looking for?

Set up demo table with data

declare @T table (ItemNumber int, location int, price decimal(11,2))

insert into @T (ItemNumber,location, price) values
(1,1,10.00),(1,2,20.00),(1,3,30.00)

select * from @T




| ItemNumber | location | price |
|------------|----------|-------|
| 1          | 1        | 10.00 |
| 1          | 2        | 20.00 |
| 1          | 3        | 30.00 |




The update statement

UPDATE @T
SET price = (
        SELECT price
        FROM @T
        WHERE location = 1
        )
WHERE location &lt;&gt; 1

select * from @T




| ItemNumber | location | price |
|------------|----------|-------|
| 1          | 1        | 10.00 |
| 1          | 2        | 10.00 |
| 1          | 3        | 10.00 |