A 表 TBR 填报人 dept 所部门属
B 表 ACCOUNT 账号 dept 所部门属
现在A表 部门字段出现空值 属于垃圾数据,要填写上部门
A表和B表 通过 TBR = ACCOUNT 关联 目的就是找出A表的dept为空的数据 根据关联从B表找出部门填写到A表上 我不会写 请高手赐教
B 表 ACCOUNT 账号 dept 所部门属
现在A表 部门字段出现空值 属于垃圾数据,要填写上部门
A表和B表 通过 TBR = ACCOUNT 关联 目的就是找出A表的dept为空的数据 根据关联从B表找出部门填写到A表上 我不会写 请高手赐教
解决方案 »
- oracle 导入csv文件问题
- myoracle 测试连接不成功 是什么原因啊
- OracleOraDb10g_home1TNSListener启动不了
- 安装oracle双机rac后的共享磁盘中能运行.net程序吗?
- 存储过程中的时间查询问题
- 高手请进,关于回滚段所占的块多少。(分不多,谢谢)
- 请问如何将oracle数据库导入到mysql数据库中
- T_3.senkogp_cd(+) = '01' 甚麽意思?
- asp ,连接orcal,乱码,求大神,页面当中utf-8,gb2312都设置过了,还是不行,直接在页面打印汉字都没有问题
- 查询结果按照特定值在前排序
- 一个备份小bat程序解读?
- 一个函数,不知道错在哪里了?
update A set A.dept=(select B.dept from B where A.TBR=B.ACCOUNT) where A.dept is null;
没有的话
UPDATE a
SET a.dept = (SELECT b.dept
FROM b
WHERE a.tbr = b.ACCOUNT
AND ROWNUM=1)
WHERE a.dept IS NULL;同一个账号会对应不同的部门的话,就看你怎么取部门了,如果也是随意的话那和上面的那个一样
update tabA a
set a.dept = (select b.dept
from tabB b
where a.TBR = b.ACCOUNT
and a.dept is null)
where exists (select 1
from tabA a, tabB b
where a.TBR = b.ACCOUNT
and a.dept is null);
commit;
select A.TBR , NVL(A.DEPT,B.DEPT) FROM A,B
WHERE A.TBR = B.ACCOUNT(+) ;
set a.dept = (select b.dept
from tabB b
where a.TBR = b.ACCOUNT
and a.dept is null)
where exists (select 1
from tabA a, tabB b
where a.TBR = b.ACCOUNT
and a.dept is null);
commit;
update A set A.dept=(select B.dept from B where A.TBR=B.ACCOUNT) where A.dept is null;
set a.dept = (select b.dept
from tabB b
where a.TBR = b.ACCOUNT
and a.dept is null)
where exists (select 1
from tabA a, tabB b
where a.TBR = b.ACCOUNT
and a.dept is null);
commit;
(select b.dept from b where a.TBR=b.account and rownum=1)
where a.dept is null;
set a.dept = (select b.dept
from tabB b
where a.TBR = b.ACCOUNT
and a.dept is null)
where exists (select 1
from tabA a, tabB b
where a.TBR = b.ACCOUNT
and a.dept is null);
commit;
set a.dept = (select b.dept
from tabB b
where a.TBR = b.ACCOUNT
and a.dept is null)
where exists (select 1
from tabA a, tabB b
where a.TBR = b.ACCOUNT
and a.dept is null);
commit;
update A
set A.dept=(select B.dept
from B
where A.TBR=B.ACCOUNT)
where A.dept is null