Harsiddhi
Harsiddhi

Reputation: 75

Update Null Value In mysql

Hello I want to update field value where Field have NULL value i am using

UPDATE video
SET    like = 0
WHERE  like IS NULL;

but it's not working . can any one help me ?

Upvotes: 1

Views: 1556

Answers (2)

akrys
akrys

Reputation: 563

like is a keyword in SQL. e.g. where textcolumn like "%TEST%"

So you'll have to escape it, if you're using it as a column name.

Try can this:

update video set `like` = 0 where `like` is null

Upvotes: 2

Suraj
Suraj

Reputation: 3127

Try this query, May be your the value of like is empty string or a spacebar.

UPDATE video
SET    like = 0
WHERE  like IS NULL
OR like =''
OR like = ' ';

Upvotes: 0

Related Questions