Search code examples
sqlmysqldatabase

Error after trying to delete contents of field in table MySQL


I have a database with a table in it that contains member profile information. I want to restore their avatars the default which will involve me deleting the entries already made. The table name is core_members and the field is called pp_main_photo.

I have used this:

UPDATE core_members SET pp_main_photo = NULL;

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Is there something wrong with my code?


Solution

  • UPDATE core_members SET pp_main_photo = NULL WHERE pp_main_photo is not null;