PG update from

  • 实例


create table ta (id int,name varchar);
insert into ta values(1,NULL),(2,NULL),(3,'c');
create table tb (id int,name varchar);
insert into ta values(1,'a'),(2,'b'),(3,'d');


update ta s set name=t.name
from tb t  
where s.id=t.id 
and s.name is NULL or s.name='';
原文地址:https://www.cnblogs.com/yldf/p/11899939.html