Reputation: 2606
Using PhpMyQdmin, how do I update ALL empty fields in a single column. I have tried a few commands I found online but none seem to do it.
Table is called "news" and column is called "profile_4" and type is "varchar(255)"
I tried this:
UPDATE news SET profile_4 = 'General' WHERE profile_4 = NULL
but it didn't work.
What I need is to update the empty column fields with 'General'
Thanks Chris
Upvotes: 1
Views: 10378
Reputation: 14638
Try this :
UPDATE news SET profile_4 = 'General' WHERE profile_4 IS NULL OR profile_4 = ''
For full reference see http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html
You cannot use arithmetic comparison operators such as =, <, or <> to test for NULL.
Upvotes: 10
Reputation: 990
UPDATE table_name SET column_name = value WHERE column_name IS NULL;
Upvotes: 3