update tb_ContactPerson set is_default = 1
where ID = 70
update tb_ContactPerson set is_default = 0
where ID not in(70)
这两条更新语句如何合并一条 请教
------解决方案--------------------------------------------------------
case...when 语法,看sqlserver帮助
------解决方案--------------------------------------------------------
update tb_ContactPerson set is_default = (Case ID When 70 then 1 else 0 end)
------解决方案--------------------------------------------------------
update AA_ContactPerson set is_default = (case when (ID =70) then 1 else 0 end)