I have no idea why this error is appearing. The query was working fine and then I tried making it prettier and then this happens
UPDATE "topTenCategories" SET "membersCount" = "tempTable"."newVal" FROM
(
VALUES
(
SELECT count(*), "g"."id" FROM
"groups" AS "g"
LEFT JOIN
"groupMembers" As "gm"
ON "g"."id" = "gm"."groupId"
WHERE "g"."isCategory" is true and "g"."parentCategoryId" is null group by ("g"."id")
)
) AS tempTable ("newVal", "id")
WHERE "topTenCategories"."groupId" = "tempTable"."id";
ERROR: syntax error at or near "SELECT"
LINE 5: SELECT count(*), "g"."id" FROM
^
SQL state: 42601
Character: 137
Any help would be greatly appreciated