So basically I'm creating a view of a buffer that fulfills some conditions, and this buffer needs to have data from point attributes in another table
This is my query that doesn't work:
CREATE OR REPLACE VIEW schema1.buffer_50_view AS
SELECT a.siteid,
a.name,
sum(select count from schema2.point_table b where count >= 50 and
st_dwithin(a.geom, b.geom, 100)) as sum_points,
st_buffer(p.geom, 100::double precision) AS buffer_50
FROM (select * from schema1.site_table p where site_progress = 100) a
it doesnt accept the sum line, and I have to add more lines like that, how to make it work?