Posgresql关联更新Sql语句

案例:

update b_tenant set act_auth = tb.auth from (
select sum(auth) as auth,tenant_id from b_tenant_app  where  deleted=0 group by tenant_id
) tb where id = tb.tenant_id

 

你可能感兴趣的:(数据库使用与维护,sql)