Getting rid of MySQL Warning: Truncated incorrect DOUBLE value


If you come across a cryptic warning like this:

| Warning | 1292 | Truncated incorrect DOUBLE value: 'xxxxxxx'

on running a MySQL query, it could be caused by using a numeric value against a CHAR/VARCHAR column.

---assuming `name` is a CHAR/VARCHAR column
---the following query might cause warnings
SELECT * FROM `t1` where `name` IN (1, 2, 3);
---replace the above with this
SELECT * FROM `t1` where `name` IN ('1', '2', '3');
--and the warnings are quite likely to go away
,

Leave a Reply

Your email address will not be published. Required fields are marked *