update table_a a set (col_a, col_b) = (select b.col_a, b.col_b from table_b b where a.col_c = b.col_c) where exists (select 1 from table_b b where a.col_c = b.col_c)
分组排序
1
select * from (select *, row_number() over(partition by col_a order by col_b) rn from table_a) t where rn = 1;
分组排序删除
1
delete from table_a where id in (select id from (select id, row_number() over(partition by col_a order by col_b) rn from table_a) t where rn != 1);