條件首先,我對此事一無所知IF
條件SQL Server 2008中如果在SQL Server 2008
我有一個表[AccountHistory]
wWith 2列AccountType
& Amount
。
AccountType
可以有不同的值(Deposit, Withdrawal, Profit,...etc
),我需要一個查詢來執行以下操作:
If AccountType = Withdrawal Then Amount = Amount * -1
例如:
AcountType Amount
-----------------------------
Deposit 100
Withdrawal -150
Profit 220
Withdrawal -200
聽起來像你可以直接用'UPDATE'語句做到這一點 –
爲什麼我得到了-ve ??? !! –
由於您表現出完全缺乏理解力和/或努力,因此您會被拒絕投票。在請求堆棧溢出幫助之前,您應該至少在理解您的問題上表現出最小的努力,因爲這些基本問題不會增加堆棧溢出的價值。生活有時候很殘酷。 –