Home > Database > Mysql Tutorial > body text

Why am I getting the 'Truncated incorrect DOUBLE value' error in my MySQL UPDATE query?

Susan Sarandon
Release: 2024-11-05 19:13:02
Original
149 people have browsed it

Why am I getting the

MYSQL Truncated Incorrect DOUBLE Value Error

When attempting to update a database using the following SQL query:

<code class="sql">UPDATE shop_category 
SET name = 'Secolul XVI - XVIII' 
    AND name_eng = '16th to 18th centuries' 
WHERE category_id = 4768</code>
Copy after login

The error "1292 - Truncated incorrect DOUBLE value: 'Secolul XVI - XVIII'" is encountered. This error occurs because the syntax of the query is incorrect. The AND keyword is not needed in this query, and it causes the update to fail.

To fix this issue, the AND keyword should be removed from the query. The correct syntax for the update is:

<code class="sql">UPDATE 
    shop_category 
SET 
    name = 'Secolul XVI - XVIII', 
    name_eng = '16th to 18th centuries' 
WHERE 
    category_id = 4768</code>
Copy after login

With this corrected syntax, the update should now be successful.

The above is the detailed content of Why am I getting the 'Truncated incorrect DOUBLE value' error in my MySQL UPDATE query?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!