Update Mysql except when field not null

Use the IS operator to compare with NULL

update your_table
set some_field = 'some value'
where some_field is not null

Using = NULL will not work since comparing with null results in unknown which is not TRUE.

Leave a Comment