access數據庫中的Round函數怎么用

access數據庫中的Round函數怎么用

access數據庫中的Round函數的使用方法:

(相關推薦:access數據庫教程

四舍五入的問題

select?round(83.124,2)?as?t?from?jqdltb

顯示為:83.12

select?round(83.125,2)?as?t?from?jqdltb

顯示為:83.12

select?round(83.126,2)?as?t?from?jqdltb

顯示為:83.13

問題來了,就是四舍五入怎么變成五舍六入了呢?

下面是用這個方法來調整達到四舍五入的方法:

使用int函數和加0.005,然后*100,再然后/100

如下所示:

select?int((83.121+0.005)*100)/100?as?t?from?jqdltb

顯示為:83.12

select?int((83.124+0.005)*100)/100?as?t?from?jqdltb

顯示為:83.12

select?int((83.125+0.005)*100)/100?as?t?from?jqdltb

顯示為:83.13

select?int((83.126+0.005)*100)/100?as?t?from?jqdltb

顯示為:83.13

select?int((83.129+0.005)*100)/100?as?t?from?jqdltb

顯示為:83.13

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊15 分享