Reputation: 6639
MySQL 8
My query:
"UPDATE `users` SET `start_date` = '2007-04-09' AND `eligibility` = 1 WHERE `user_id` = 36;
I am getting the following error:
Warning: #1292 Truncated incorrect DOUBLE value: '2007-04-09'
I checked the type for the start_date field and it it set to date.
When I check the row, I find that it has NOT been modified, even though this is a warning.
I am using the PHPMyAdmin interface to interact with the MySQL DB/Server.
Any ideas?
The answer is that I used an AND statement, instead of a comma. I have not used MySQL for a while. I use ORM instead, so I did not notice the error, and the error message threw me off.
Upvotes: 1
Views: 54
Reputation: 98388
You are setting start_date to:
'2007-04-09' AND `eligibility` = 1
You need a comma instead of AND
there if you want to set eligibility too.
That specific message comes because '2007-04-09' AND
interprets that string as a Boolean, which it is calling a DOUBLE.
Upvotes: 2