MySQL提示Truncated incorrect DOUBLE value解决方法

“Truncated incorrect DOUBLE value”的解决方法主要是这两种:

1、修改了多个列的值而各列之间用逗号连接而不要用and

  • 错误写法示例:update tablename set col1=value1 and col2=value2 where col3=value3;
  • 正确写法示例:update tablename set col1=value1 ,col2=value2 where col3=value3;

2、SQL语句在拼接字符串时使用函数CONCAT()而不要用“+”

3、单数引号问题
String sql="UPDATE arrange SET askForLeave='是' WHERE employeeNum=“+employeeNum+” and arrangeDate="+leaveDate;
改成了
String sql="UPDATE arrange SET askForLeave='是' WHERE employeeNum='"+employeeNum+"' and arrangeDate='"+leaveDate+"'"
在字符串变量前后加了单引号

4、在查询时查询条件的类型和字段类型不符

 


 

你可能感兴趣的:(MySQL提示Truncated incorrect DOUBLE value解决方法)