用select case 来写吧``具体你看下```在家没环境```
解决方案 »
- SQL语句改正,在线等,非常非常急!!!!!!!
- 菜鸟求问
- [记得小F姐有]t-sql自动生产测试数据
- 怎么用程序写 bcp 的格式文件
- 简单数据库问题,请高手指点
- 一个简单的条件,谢谢
- sql server 2005 出现一个错误,但 SQL Server Integration Services 向导未做好处理该错误的准备
- 表间关连和内嵌视图间关连的区别问题,高手看看
- 如何缩小数据库?大家对超大数据库是怎么处理的,有没有想过转移部分数据的方法。
- 请问如何得到局域网中的所有SQl SERVER服务器的列表?不用sqlserver的sqldmo库!
- 急求一条SQL语句(在线等,结贴快)
- 无法删除数据库 因为它正用于复制
如果b1<>null,b2=null,b3<>null,b1->a1,b3->a2不明你的意思~update a1= case when b1 is null and b2 is null and b3 is not null then b3
when b1 is null and b2 is null and b3 is not null then b3 else a1 end
如果b1<>null,b2=null,b3<>null,b1->a1,b3->a2
..什么按多几下空格就发出去了?
update a1= case when b1 is null and b2 is null and b3 is not null then b3
when b1 is not null and b2 is null and b3 is not null then b1 else a1 end,
a2 =case when b1 is not null and b2 is null and b3 is not null then b3 else a2 end
我的sql:
update dw_case_archives4_main
set a1=
case when b1 <> '' then b1
else
(
case when b2 <> '' then b2
else
(
case when b3 <> '' then b3
else ''
end
)
end
)
end update dw_case_archives4_main
set a2 =
case when b2 <> '' and b2 <> a1 then b2
else
(
case when b3 <> '' and b3 <> a1 then b3
else ''
end
)
end
where a1 is not null
update dw_case_archives4_main
set a3 =
case when b3 <> '' and b3 <> a2 then b3
else ''
end
where a2 is not null