asid qiiq
asid qiiq

Reputation: 33

SQL Update Statement for all values of column when value equals certain value

How would I update all row values of a SQL table in a column when the value equals a certain value?

For Example (TableA):

ColumnA | ColumnB | ColumnC
---------------------------
a       | b       | c
a       | x       | c
a       | x       | c
a       | x       | c
a       | b       | c
a       | b       | c

I would I rename all x in ColumnB to y?

Upvotes: 0

Views: 4271

Answers (2)

Orion
Orion

Reputation: 452

UPDATE [TableA]
SET [ColumnB] = 'y'
WHERE [ColumnB] = 'x'

Upvotes: 2

Gordon Linoff
Gordon Linoff

Reputation: 1269463

If I understand correctly, this is simple update:

update tableA
    set columnb = 'y'
    where columnb = 'x';

Upvotes: 8

Related Questions