Springmoon-venn

案列:

  想更新A表的name字段,由于失误,在写这个表的时候,这个字段没有写,发现的时候,已经写了一个多月的数据了。改了之后的过程,会正常的写这个字段,

  可是已经写了的数据也不能铲了,重新计算。

  好在A表的name是可以从B表通过code关联查出来的。

  于是,就有了下面这句sql。

update table_a a set a.name=
(select bname from table_b b 
where b.code=a.code and rownum= 1 and a.name is null);

 

ORACLE 实用案列

分类:

技术点:

相关文章:

  • 2021-11-15
  • 2021-10-20
  • 2021-08-21
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-12-09
  • 2021-12-08
猜你喜欢
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
  • 2021-10-20
相关资源
相似解决方案