关于百分比计算的问题 [英] Question on Percentage Calculation

查看:82
本文介绍了关于百分比计算的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

百分比=(现在)/(totaldays-weekoff)

考虑这是出席率,它显示ZERO



任何人都可以帮我找到解决方案,即SQL中是否有任何意义,或者通常可以在数学上进行评估。

解决方案

不要使用INTEGER数据类型。

如果Present是整数,那么除以它的任何东西都是整数,所以小于1的数字变为零。



试试这个证明:

百分比=(现在*  100 )/(totaldays-weekoff )


for eg:
Percentage=(Present)/(totaldays-weekoff)
consider this is for attendance percentage,it displays ZERO

Can anyone help me to find the solution i.e., is there any significance in SQL or normally it can be evaluated Mathematically.

解决方案

Don't use INTEGER datatypes.
If Present is integer, then anything divided by it is integer, so numbers less than 1 become zero.

Try this to prove it:

Percentage=(Present * 100)/(totaldays-weekoff)


这篇关于关于百分比计算的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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