update tablename set C=(case when C is not null then 1 else C end)
set D=(case when D is not null then 2 else D end)
....E=...............................3.....E ....
解决方案 »
- 一个update表中text类型字段的奇怪问题
- 重新命名栏位的名字。例句
- sql server基础类,请求解答
- 新手求助!!!!!!!!
- 使用SQL SERVER Analysis Services 时,如何将多维的查询结果导出来呢?难道只能在Analysis Manager里看么?
- 请问这样一组数据如何格式化,希望用函数实现!进来看看,在DELPHI里面函数实现了,但在SQL 里面函数怎样写呢?
- sql备份还原的问题
- 如何用SQL语句移动列的顺序!?
- 对于此SQL语句该怎么改,一个主表,两个从表
- 关于全文索引.. 有答案或者经验之谈就结贴~~[80]
- 视图和表的同步,有人会吗?
- 如何利用触发器进行定时存储?着急!!!谢谢!
update tablename set C=(case when C is not null then 1 else C end)
set C=(case when D is not null then 2 else D end)
....C=...............................3.....E ....
系统提示我多次出现C列怎么办呢?
表a
A B C D E
a 4 4
b 4 4
c 6 6
d 6 6
e 6 6
f 6 6
表b
A B C D E
a 4 1
b 4 1
c 6 2
d 6 1
e 6 2
f 6 3
a表怎么能变成b表的效果呢?
就是说当c列不为空,把c列值修改成1
d列不为空,把c列值修改成2
e列不为空,把c列值修改成3
谢谢老大帮帮忙吧
update 表A set C=(case when D is not null then 2 else C end)
update 表A set C=(case when E is not null then 3 else C end)
when d is not null then 2
when c is not null then 1
else C end)
when D is not Null then 2
when E is not Null then 3 end)