使用 CASE 更改列的值
Change value of column using CASE
我可以在 SQL 服务器
中用 CASE
做类似下面的事情吗
(Case When location = 'Columbia' Then (direction = 942) Else direction End) as newdirection
原来哥伦比亚的方向是941
你不需要赋值表达式,只需要 return 942。你也不需要括号:
Case When location = 'Columbia' Then 942 Else direction End as newdirection
我可以在 SQL 服务器
中用CASE
做类似下面的事情吗
(Case When location = 'Columbia' Then (direction = 942) Else direction End) as newdirection
原来哥伦比亚的方向是941
你不需要赋值表达式,只需要 return 942。你也不需要括号:
Case When location = 'Columbia' Then 942 Else direction End as newdirection