我对一个视图运行一个非常简单的查询,它使用一个值,并且不能与其他值一起工作。我试图从不同的索引值视图中选择行只指数1.5返回的结果关于Mysql查询查询无法正常工作
以下是查看表的样本
我有这种说法easylens
select * from easylens
+---+----+------+----+-----+-----+-----+-------+--------+
|id |type|design|name|brand|index|color|coating|material|
+---+----+------+----+-----+-----+-----+-------+--------+
| 1 | sv |aase |nel |hoya | 1.5|292 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
| 2 | sv |base |tel |zeri | 1.5|293 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
| 3 | sv |case |fel |essi | 1.5|294 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
| 4 | sv |dase |gel |hoya | 1.6|293 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
| 5 | sv |fase |rel |essi | 1.6|293 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
| 6 | sv |gase |mel |hoya | 1.6|292 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
当我运行
select * from easylens where `index`=1.5
我得到
+---+----+------+----+-----+-----+-----+-------+--------+
|id |type|design|name|brand|index|color|coating|material|
+---+----+------+----+-----+-----+-----+-------+--------+
| 1 | sv |aase |nel |hoya | 1.5|292 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
| 2 | sv |base |tel |zeri | 1.5|293 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
| 3 | sv |case |fel |essi | 1.5|294 |ar |plastic |
+---+----+------+----+-----+-----+-----+-------+--------+
但是当我运行
select * from easylens where `index`=1.6
我得到
MySQL returned an empty result set (i.e. zero rows). (Query took 0.0002 sec)
w^hat是'index'字段的数据类型? – Sadikhasan 2014-09-10 10:51:05
@Sadikhasan索引字段为float – Bakly 2014-09-10 10:57:31
将其更改为DECIMAL - 或者它可能足以在FLOAT中定义精度和比例 - 但我不确定为什么 – Strawberry 2014-09-10 11:00:20