I have tried this three different ways and PostgreSQL still doesn't like that I am "aggregate functions are not allowed in UPDATE". I am not sure how to this without doing that. Can someone point me in the right direction to populate my average Wage field with my average wages?
Attempt 1:
UPDATE public."JobCategory"
SET "AverageWage" = round(avg("Wage"), 4)
FROM public."Employees" WERE "Wage" > 0
Attempt 2:
UPDATE public."JobCategory" c
INNER JOIN (
SELECT round(avg("Wage"), 4) as average
FROM public."Employees"
) x ON c."Index" = x."JobIndex"
SET c."AverageWage" = x.average
Attempt 3:
UPDATE public."JobCategory" AS v
SET "AverageWage" = s.round(avg("Wage"), 4)
FROM public."Employees" AS s
WHERE v."Index" = s."JobIndex"