原因是用set更新多个值时,多个值错误的用and连接,改为用","逗号连接得以解决
做个测试,原始数据如下
执行 update user set user_count = 8 and user_address = '成都' where user_id = 66;
执行 update user set user_count = 8 and user_address = '上海' where user_id = 67;
发现mysql把and当成逻辑与运算了,
若user_address和原数据相同,user_count总变为1.
若user_address和原数据不同,user_count总变为0.
目前只发现int类型字段这种情况,varchar类型sql直接报错
解决:and变为“,”,即update user set user_count = 8 and user_address = '成都' where user_id = 66;