Skip to content
Advertisement

Updating empty cells with filled cells values in duplicate records without unique key

I have a table tblPhone which contains duplicate records. E.g.

As you are seeing above sample table have two duplicate records without uniquely identified KEY.

  1. Question 1 is: How I can uniquely identify each duplicate record in table?

  2. See the Note column which has NULL value in first row and Valu some values in second row. Question 2 is: How I can update the value from filled cell Valu into empty/NULL cell?

  3. Question 3 is: How I can take and update the lowest number value in each cell in Class column?

The UPDATE query that I tried to write is below but confused in CASE ELSE clauses:

I have also created sample table schema here in SQL Fiddle.

Database is created in SQL Server 2017.

Advertisement

Answer

You can use a subquery:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement