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

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -