私は1つの質問がありますが、テーブルから選択したいがエイリアス列を持ち、各列には条件付きが1つあります。値がSQL - 各列には1つの条件があります
Select Value, Target, Plan from Product
条件があります、すべてのおかげで:where Product.DetailCode = 'B'
、 列Value =Product.Value * 100
EDIT:私はC#でのようにしたい:
if(Product.DetailCode == 'A') {Value = Product.Value * 10} else if(Product.DetailCode == 'B') {Value = Product.Value * 100}
EDIT2 where Product.DetailCode = 'A'
列を、ターゲットの条件を持っています 最後に、私は自分の答えを持っています。
select case when product.code = 'A' then product.Value * 10 end as Value, case when product.code = 'B' then product.Value * 100 end as Target from product
本当にありがとうございました!
ご質問はありますか? –
'Product.DetailCode = 'A'とProduct.DetailCode = 'A''はどこですか?それは働いていないのですか? –
のようなものを探しています: 'Product.DetailCode = 'A'またはProduct.DetailCode = 'A'' –