I have a column filled with dates, some of which are duplicates, and I want to change all the ones greater than 2012-05-28 to NULL. Here is the statement I’m using:
UPDATE my_data SET date_firstnewtumor=NULL
WHERE date_firstnewtumor>2012-05-28;
However, MySQL Workbench is giving me this error message: “…you tried to update a table without a WHERE that uses a key column.”
I then tried the above code in MySQL Command Line Client and it changed the entire column date_firstnewtumor to NULL.
I’ve looked at examples of code online and I could swear their WHERE statement was similar to mine. What am I doing wrong?
Thank you for your advice!
I think you’ll just want to specify the date literal correctly:
Or simply: