MySQL: #1292 - Truncated incorrect DOUBLE value: '…'

笑着哭i 提交于 2021-01-29 07:13:55

问题


I'm trying to create a MySQL query to update PAN no of all members.

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.

UPDATE if_membermaster SET PAN_No = 'ABCD1234D' WHERE 'MemberCode'  = 5100

Result:

ERROR:- #1292 - Truncated incorrect DOUBLE value: 'MemberCode'

MemberCode is int(9) DEFAULT NULL.

Can any one help to fix this ?


回答1:


You are using wrong quotes (PEBCAK). The where clause is comparing the string 'MemberCode' with 5100. This forces MySQL to convert both values to double hence the warning. Change single quotes to backticks:

UPDATE if_membermaster SET PAN_No = 'ABCD1234D' WHERE `MemberCode` = 5100


来源:https://stackoverflow.com/questions/52622105/mysql-1292-truncated-incorrect-double-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!