【发布时间】:2014-04-02 11:25:48
【问题描述】:
我正在从 VB.NET 应用程序启动查询 (Access 2003)。
select id, customer, date, total, iif ([amountGet] - [amountSent] = [total], 'Yes', 'No') as result from invoices
但是iif返回错误的结果
表格
编号:1
客户:佩佩
日期:2014 年 1 月 1 日
总计:1,8
数量获得:5
发送金额:3,2
结果:
返回“否”
什么时候应该返回“是”,因为 5-3,2=1,8
【问题讨论】:
-
amountGet、amountSent、total有哪些类型?这很可能是由于舍入错误造成的。
-
双(自动小数)
-
小数位使用
,而不是.可能是您的区域设置有问题吗?您是否尝试在即时窗口中运行它? -
您好:按照 jpw 的 cmets,现在我将四舍五入到小数点后 2 位,看起来效果很好。 iif ( round([amountGet] - [amountSent],2) = round([total],2) )