I want to update the table paneldata setting the column ibase using an aggregate function.
UPDATE paneldata p SET ibase=SUM(1/i.dist) FROM ibaselang i WHERE p.gid=i.gid AND i.instp<p.period This results in ERROR: aggregate functions are not allowed in UPDATE
TABLE DEFINITIONS
CREATE TABLE public.ibaselang ( gid integer, dist double precision, buildid integer, instp smallint ) WITH ( OIDS=FALSE ); Solution Approach
Unfortunately I don't know how to implement my WHERE functions in a subquery.