SimonLiu
SimonLiu

Reputation: 19

How to update one table row with same keys by SQL?

I have a table T like this:

Name(Not unique)     Value   
A                      1
A                      3 
A                      5  
A                      8

And if I only want to update the 3rd row, how to write the SQL?

Below SQL does not work, it updates all the rows.

update T set Value='10' where Name='A'  

Upvotes: 1

Views: 201

Answers (2)

Jignesh.Raj
Jignesh.Raj

Reputation: 5987

UPDATE T SET Value='10' WHERE value=5

Upvotes: 1

x2.
x2.

Reputation: 9668

update T set Value='10' where Name='A' and value=5

Upvotes: 4

Related Questions