我写了一个SQL查询进行一些计算 [英] I write a Sql Query for some calculation

查看:72
本文介绍了我写了一个SQL查询进行一些计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一些计算的Sql查询

I write a Sql Query for some calculation

Declare @fltAdjQuantity as float
Set @fltAdjQuantity = 1.0714285714285714
select @fltAdjQuantity
select @fltAdjQuantity - 1



@fltAdjQuantity = 1.0714285714285714,当我用(-1)扣除时,它将得到7.1428571428571397E-2而不是0.0714285714285714 [1.0714285714285714-1 = 0.0714285714285714].
请帮我,我正在等待.....



@fltAdjQuantity = 1.0714285714285714 and when I deducted it with (-1) It will give 7.1428571428571397E-2 instead of 0.0714285714285714 [1.0714285714285714 - 1 = 0.0714285714285714 ].

Please Help me i am waiting.....

推荐答案

没有错.这是预期的结果,具有预期的准确性.别忘了,这些计算是近似的.您也可以通过double.ToString(string format)使用所需的格式以字符串形式显示数值.另请参见:
http://msdn.microsoft.com/en-us/library/system.double. tostring.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx [ ^ ].

—SA
There is nothing wrong. This is expected result, with expected accuracy. Don''t forget, the calculations are approximate. You can also present the numeric values in the string form using format you need through double.ToString(string format). Please see also:
http://msdn.microsoft.com/en-us/library/system.double.tostring.aspx[^],
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx[^],
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx[^].

—SA




Hi,

Declare @fltAdjQuantity as float
Set @fltAdjQuantity = 1.0714285714285714
select @fltAdjQuantity
select @fltAdjQuantity - 1



我在上面的查询中检查了您,它给了我0.0714285714285714,您需要它作为答案.

请详细说明您的问题.



I checked you above query and it is giving me 0.0714285714285714 which you need as an answer.

Pls elaborate your question.


这篇关于我写了一个SQL查询进行一些计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆