Not being an SQL expert, I am having trouble with a simple replacement of a specific date-time value with NULL in MySQL. The nullable last_login DATETIME column in question may have values of '1900-01-01 00:00:00.000' as a result of populating rows from an Excel spreadsheet which do not have that date (i.e. empty cells). Each database row is uniquely identified by an id INT column. I tried:
UPDATE user_profiles
SET last_login = NULL
WHERE id IN
(SELECT id FROM user_profiles WHERE last_login = '1900-01-01 00:00:00.000');
But MySQL (and I suspect other databases as well) protests that the WHERE clause applies to the same column as the one being updated. What is the solution?
update user_profiles set last_login = NULL where last_login = '1900-01-01 00:00:00.000'?