use SUM on foreign keys where it matches rows id?
Join to the aggregate, don't aggregate the join:

SELECT b.id AS building_id,
      (b.document -&gt; 'meta'::text) -&gt;&gt; 'name'::text AS name,
      r.sqft
FROM buildings b
  JOIN (
   SELECT building_id, 
          sum(sqft) as sqft
   FROM v_rooms
   GROUP BY building_id
  ) r ON r.building_id = b.id;




Unrelated, but: although Postgres allows it, it's usually a bad idea to include an ORDER BY in a view definition.