seb
seb

Reputation: 7

How to replace elements in sql

I got an array like that :

name      Description

R          mono        
R          mono

Q          trio
Q          trio
Q          duo

My aim is to say " when Q="duo" then Q= "R" but I must do that in SQL.

Then I got it :

name      Description

R          mono        
R          mono
R           duo

Q          trio
Q          trio

Thanks for reading me

Upvotes: 0

Views: 63

Answers (1)

gcj
gcj

Reputation: 298

Not sure if I understood the question correctly but if what you are looking is to replace the column name for the the row where descriptions is equal to mono, this should be work:

UPDATE table_name
SET name = 'R' where Description = 'duo';

This will update rows with description as duo and will change the name to R.

Upvotes: 2

Related Questions