俱乐部更新查询与组通过基于两个属性// postgres
答
更新PostgreSQL有一个FROM extension你可以使用:
update YourTable as yt1
set c = case when aggr.cnt > 5 then 'Q' else 'Z' end
from (
select a
, b
, count(*) as cnt
from YourTable
group by
a
, b
) as aggr
where aggr.a = yt1.a
and aggr.b = yt1.b