存储mysql浮点值

时间:2014-08-12 20:43:55

标签: mysql floating-point

我想在mysql数据库中存储一个双精度数字(来自objective-c的[NSDate timeIntervalSinceReferenceDate]返回值)。
查询似乎执行正常,但是当我执行选择查询时,它返回1.00000 我不知道为什么。我搜索了网络上的线索,很多人提出但没有解决我的问题。 你们能帮忙吗?

更新查询

update tblPurchased 
set 
    sync = '429568293.63687'
        and consumablecount = 0
where
    id = 2;

来自mysql workbench的结果

22:52:09    update tblPurchased  set      sync = '429568293.63687'         and consumablecount = 0 where     id = 2 0 row(s) affected Rows matched: 1  Changed: 0  Warnings: 0  0.003 sec

22:58:25    update tblPurchased  set      sync = 429568293.63687         and consumablecount = 0 where     id = 2   0 row(s) affected Rows matched: 1  Changed: 0  Warnings: 0  0.003 sec

描述表

'sync', 'decimal(15,5)', 'NO', '', '0.00000', ''

选择查询的结果

"id", "sync"
'2', '1.00000'

1 个答案:

答案 0 :(得分:2)

我需要学习如何编写更新查询...

update tblPurchased 
set 
    sync = '429568293.63687'
        and consumablecount = 0 
where
    id = 2;

应该是

update tblPurchased 
set 
    sync = 429568293.63687,
    consumablecount = 0
where
    id = 2;