1

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 ?

4
  • maybe like is not NULL. might be empty string Try this instead : ..WHERE like IS NULL OR like = '' Commented Oct 3, 2016 at 9:56
  • What exactly do you mean that your query does not work? Commented Oct 3, 2016 at 9:58
  • Not working is not enough information. Are you getting any error ? I suppose you should have an error. Commented Oct 3, 2016 at 9:59
  • Also note that like is a reserved word. Enclose it by backtick while using Commented Oct 3, 2016 at 10:01

2 Answers 2

2

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
Sign up to request clarification or add additional context in comments.

Comments

0

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 = ' ';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.