感谢 @锋云战锦 和 @苏生不惑 的回答, 我从 mysql 官网摘抄了如下解释,能很好的解答我的疑惑:
Comparisons that use floating-point numbers (or values that are converted to floating-point numbers) are approximate because such numbers are inexact. This might lead to results that appear inconsistent: 官网给出的示例如下:
感谢 @锋云战锦 和 @苏生不惑 的回答, 我从 mysql 官网摘抄了如下解释,能很好的解答我的疑惑:
https://dev.mysql.com/doc/refman/5.7/en/type-conversion.html
id=201511051505538905
它的数据类型为int
而你的id的数据类型为string,当然查不到,但你可以转换为int
cast(id as int)
where id=201511051505538905
id是char类型 而你用数字比较,mysql会将字符串转为数字,就是0 201511051505538905 != 0