我正在使用以下查询更新值
setRequestedOrientation()
此查询有效,但它也更新了field_number = 4.3和field_number = 4.4的值。
field_number字段类型为float。
我做错了吗?
由于 Ballu
答案 0 :(得分:2)
您正在投射到DECIMAL
,它没有小数。
您需要将(M,D)添加到DECIMAL(M,D)
。
mysql> select CAST(4.3 AS DECIMAL);
+----------------------+
| CAST(4.3 AS DECIMAL) |
+----------------------+
| 4 |
+----------------------+
1 row in set (0.00 sec)
mysql> select CAST(4.3 AS DECIMAL(10,5));
+----------------------------+
| CAST(4.3 AS DECIMAL(10,5)) |
+----------------------------+
| 4.30000 |
+----------------------------+
1 row in set (0.00 sec)
mysql> select CAST(4.3 AS DECIMAL(10,5)) = CAST(4.2 AS DECIMAL(10,5));
+---------------------------------------------------------+
| CAST(4.3 AS DECIMAL(10,5)) = CAST(4.2 AS DECIMAL(10,5)) |
+---------------------------------------------------------+
| 0 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
-- Add some decimal
UPDATE cfbnv_rg_lead_detail SET value='Address' WHERE lead_id='175' && form_id='1' && CAST(field_number AS DECIMAL(10,5)) = CAST(4.2 AS DECIMAL(10,5)).