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

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

Susan Sarandon
Susan SarandonOriginal
2024-11-05 19:13:02211browse

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>

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>

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!

Statement:
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