if-then在SQL Server中

New*_*rus 4 sql sql-server

我需要在SQL Server中创建一个基本上应该说的命令

If table1.columnx = 1
then update table2 set comumnx = 1
Run Code Online (Sandbox Code Playgroud)

它应该很简单,但我无法想出解决方案.

Der*_*omm 11

update t2
set columnx = 1
from table1 t1 
inner join table2 t2
on t1.id = t2.id
where t1.columnx = 1
Run Code Online (Sandbox Code Playgroud)