to shuixin13 可以是可以了,但是用不到索引to _Shakespeare 若为字符串如何解释select 10001188 = '1.00011880000000000e+007' -> 1谁能说一说内部转换机制
select * from table where id = '1.00011880000000000e+007'ID应该是被转换成了字符型, 如果你用这个一定行的select * from table where id = '1.00011880000000000e+007'+0
能告诉原因吗按mysql手册 在int与字符串比较的时候,应该都转换成浮点型进行转换 为什么会这样
这是自动转换,mysql在安全性考虑这方面做得还可以,但在mysql4.0以前的版本就不行了。
呵呵,正如 bombshell(水中鱼)所说, 我用MySQL4.0.4重新试了一下,1 select * from table where id = '1.00011880000000000e+007'2 select * from table where id = 1.00011880000000000e+0073 select * from table where id = 100011884 select * from table where id = '10001188'这四个 SQL 都可以得到正确的结果了, 可以MySQL在3.23版上有此BUG吧
'1.00011880000000000e+007' 被看做'1.00011880000000000e+007'--字符穿而1.00011880000000000e+007 被看做1.00011880000000000e+007---数据浅妄薄见,望与斟酌
-> 1谁能说一说内部转换机制
where id = '1.00011880000000000e+007'ID应该是被转换成了字符型,
如果你用这个一定行的select * from table
where id = '1.00011880000000000e+007'+0
在int与字符串比较的时候,应该都转换成浮点型进行转换
为什么会这样
我用MySQL4.0.4重新试了一下,1 select * from table
where id = '1.00011880000000000e+007'2 select * from table
where id = 1.00011880000000000e+0073 select * from table
where id = 100011884 select * from table
where id = '10001188'这四个 SQL 都可以得到正确的结果了,
可以MySQL在3.23版上有此BUG吧