0

Why I am getting this error when I execute this sql statement ,anybody with an idea? THIS IS SQL

UPDATE sub_category SET `name`="Motor Bike" AND category_id="13" WHERE id= "3" LIMIT 1

THIS IS RESULT

Warning: #1292 Truncated incorrect DOUBLE value: 'Motor Bike'

1 Answers1

0

The code you want does not use and:

UPDATE sub_category
    SET name = 'Motor Bike',
        category_id = '13'
    WHERE id = 3
    LIMIT 1;

Your code is interpreted as:

SET name = ('Motor Bike' AND category_id = '13')

That is, the AND is a boolean AND that connects two expressions.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786