MySQL: detecting a text "NULL" or 0 field and changing it to proper NULL -


i have following bit of code

update  table_one  set  field_one = case      when field_one = 'null' or field_one = 0     null     else field_one   end 

so want see if field has string "null" or 0 (0) value. if should set null within database.

the issue i'm having it's setting null in fields while other fields okay.

is there wrong code?

update table_one set    field_one = null  field_one = 'null' or     field_one = '0' 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -