MySql updating column that is null -


i trying update column value has null value.

table:

+------------+-----------+-------+ | product_no | name      | price | +------------+-----------+-------+ |          1 | cheese    |  9.99 | |       null | meat      | 17.00 | |          2 | pepperoni |  null | +------------+-----------+-------+ 

update:

update products set product_no = 6 product_no = null; 

output:

query ok, 0 rows affected (0.00 sec) rows matched: 0  changed: 0  warnings: 0 

table definition:

+------------+---------------+------+-----+---------+-------+ | field      | type          | null | key | default | | +------------+---------------+------+-----+---------+-------+ | product_no | int(11)       | yes  |     | null    |       | | name       | varchar(255)  | yes  |     | null    |       | | price      | decimal(10,2) | yes  |     | null    |       | +------------+---------------+------+-----+---------+-------+ 

why not updating 6?

try this:

update products set product_no = 6 product_no null; 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -