IIF语句拒绝返回Null

时间:2017-06-29 08:54:23

标签: sql ms-access

SELECT TInvoiceDetails.ProductID, IIF([ProductID]="APP-001",Null,[TInvoiceDetails].[#of]) AS [#of]

我有上面的sql代码,我想要的是这个输出:

ProductID      | #of
____________________
APP-001        | 
something else | 12

我得到的是这个输出:

ProductID      | #of
______________________
APP-001        | 2500
something else | 12

基表是:

ProductID      | #of
______________________
APP-001        | 2500
something else | 12

1 个答案:

答案 0 :(得分:0)

因为我使用[ProductID] >LL?\-000的输入掩码,所以解决方案是:

SELECT TInvoiceDetails.ProductID, IIF([TInvoiceDetails].[ProductID]="APP001",Null,[TInvoiceDetails].[#of]) AS [#of]