我试图在CASE语句中使用不同的代数表达式(+, - ,*,/),但我遇到了一些麻烦。
基本上语法是,如果货币是GBp(小p意味着便士),我希望它乘以100,使其成为GBP(即便士为磅)
这是我的查询。我想我错过了一些简单的事情!
select Currency, FXrate
case
when Currency = 'GBp'
then FXrate = FXrate * 100
end
from FXdatabase
答案 0 :(得分:2)
据推测,你想要这样的东西:
select Currency,
(case when Currency = 'GBp' then FXrate * 100 else FXrate
end) as FXrate
from FXdatabase;