sql - Update and self join -
i want update blank name column in client table using non-blank column same client number. know how should modify below sql? thanks,
update client set name=(select name client (name not null , name<>'') ) client c1, client c2 (name null or name='') , c1.client_no=c2.client_no
i recommend using window functions purpose:
with toupdate ( select c.*, max(name) on (partition client_no) maxname client c ) update toupdate set name = maxname name null or name = '';
Comments
Post a Comment