Page 1 of 1
[SOLVED] mysql updating NULL
Posted: Mon Jan 23, 2006 11:08 am
by wtf
Code: Select all
update table set column = 'value' where column = NULL
Code: Select all
update table set column = 'value' where column = 'NULL'
I can't get it to work! What's the trick???
Posted: Mon Jan 23, 2006 11:18 am
by feyd
the first one would be it. Are you sure the column supports NULL values? Maybe it's a blank string instead?
Posted: Mon Jan 23, 2006 11:19 am
by Burrito
Code: Select all
update `table` set `column` = 'value' where isnull(`othercolumn`) or `othercolumn` = ''
Posted: Mon Jan 23, 2006 11:47 am
by wtf
Are you sure the column supports NULL values? Maybe it's a blank string instead?
I tried blank string and it updated only blank fields, fields with NULL stayed untouched. Burrito's solution worked so it's all good.