Search code examples
mysqlsqlwoocommercemysql-error-1054

MySQL Truncated incorrect DOUBLE value error


I'm trying to create a MySQL query to update all of the product variations tax class in Woocommerce.

Using the query below I keep getting this error and its not something I've come across before, google seems to offer a variety of answers but I'm unable to relate the fix to my query.

I'm getting the error - #1292 - Truncated incorrect DOUBLE value: 'product'?

I don't understand where the value of product comes from in the error?

UPDATE wp_postmeta a 
   JOIN wp_posts b ON b.id = a.post_id  
   SET a.meta_value = 'test456'

WHERE b.post_type = 'product_variation' & a.meta_key = '_tax_class'

Thanks for reading


Solution

  • Try this:

    UPDATE wp_postmeta a 
    JOIN wp_posts b ON b.id = a.post_id  
    SET a.meta_value = 'test456'
    WHERE b.post_type = 'product_variation' and a.meta_key = '_tax_class'