读书人

这两条更新语句怎么合并一条 请问

发布时间: 2012-10-31 14:37:32 作者: rapoo

这两条更新语句如何合并一条 请教
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)

读书人网 >asp.net

热点推荐