言葉にできるは武器なるらしい

言葉に文字に残していきます何事も。いつかきっと誰かの役に立つはずだから。

SQLServer 条件ごとに更新の値を変える方法

これは使えるのでメモメモ

 

update A

set A.hogehoge=(case

       when punipuni = '1' then '202'

       when punipuni = '2' then '203'

       else '204'

       end)

from table1,table2

 where とってくるデータの条件