Udders
Udders

Reputation: 6986

MySQL update not performing action

I am trying to run the following query,

UPDATE candidate_assets SET show = 1 WHERE show = 0;

to change all the rows (show) that are set to 0 to be equal to 1, the show column is just basic INT column, what am I doing wrong?

Upvotes: 1

Views: 82

Answers (2)

Alexander Palamarchuk
Alexander Palamarchuk

Reputation: 879

Use qoutes for fields with names which are reserved in MySQL like "show":

UPDATE candidate_assets SET `show` = 1 WHERE `show` = 0;

Upvotes: 3

eggyal
eggyal

Reputation: 125925

SHOW is a keyword in MySQL. Try escaping references to your column by surrounding them with backtick ` marks:

UPDATE candidate_assets SET `show` = 1 WHERE `show` = 0;

Upvotes: 4

Related Questions