Mysql [Err] 1292 - Truncated incorrect DOUBLE value: 'a'

报错信息:

[SQL]
UPDATE 表 set times = 1 where type = 1 and times = 0

[Err] 1292 - Truncated incorrect DOUBLE value: 'a'

 

解决方案:

属于类型错误,type为vachar类型,具体是什么样的查询顺序我也不太清楚。经过测试,

我觉得是 times = 0 的条件中,含有 type = a 的结果,所以 user_type=1,需要添加单引号。

 

结果:

UPDATE 表 set times = 1 where type = '1' and times = 0

 

最后:

一定要严格写sql,vachar类型的一定用单引号,否则索引都使用不上。

posted @ 2017-08-01 15:43    阅读(10445)  评论(0编辑  收藏  举报