i have a table in sql server.
id start end value flag
1 10 20.2 102 T
2 22 11 133 T
3 12.1 15 pending F
4 10 20.2 pending F
5 22 11 pending F
as you can see, start and end is same for row 1 and 4, and row 2 and 5.
But value ofrow with id 1 is 102, and that of 4 is pending,
i want to write a query, which looks for another occurance of same start and end and then update the column value to the value of respective start and end, if it is pending. else leave it
i.e I want to update the value column of the rows with id 4 and 5, with values in row with id 1 and 2.(pending to the respective value)
final result i am looking for is this:
id start end value flag
1 10 20.2 102 T
2 22 11 133 T
3 12.1 15 pending F
4 10 20.2 102 F
5 22 11 133 F
start=10 and end=20.2, as you can see, in row with id 4, the start and end are same as that of row 1, but the value is pending in row 4. i want to update the pending to the value of row with id 1, since in both rows,start and end are same