2013-03-01 68 views
0

我有3個價值saleprice,productprice和reward_price。 我需要首先查找saleprice,如果沒有saleprice,請查看productprice。然後抓住它,並上下五十美分。洙..MS Access舍入問題

  • 4.49 = 4 reward_price = 4
  • 4.50 = 5 reward_price = 5
+0

具體地,參見[這裏Remou的交](http://stackoverflow.com/a/266745/334849) – LittleBobbyTables 2013-03-01 19:51:31

回答

0
SELECT 
    Format(IIf(saleprice Is Null, productprice, saleprice), '#') AS reward_price 
FROM YourTable; 

Format()返回一個字符串。如果需要reward_price作爲實際數,可以包轉換函數內的字段表達式如Val()CCur()CInt()

+0

非常感謝,它的工作! – 2013-03-01 20:28:26