Dawine
Dawine

Reputation: 43

Is there a way to run one query instead of those two in PosgreSQL/PostGIS

The first query is:

SELECT ST_Union(ST_Buffer(geom_kiosk, 250)::geometry(Polygon, 32618)) as geom 
FROM tbl_kiosk 
WHERE cte = 'ctejeremie' 
      and status = 'functional' and type = 'public';

The second query is:

INSERT INTO tbl_buffer (geom_buffer, distance, cte, date_added) 
VALUES(geom, 250,'ctejeremie', now());

Thanks

Upvotes: 1

Views: 43

Answers (1)

Dawine
Dawine

Reputation: 43

INSERT INTO tbl_buffer (geom_buffer, distance, cte, date_added)
SELECT ST_Union(ST_Buffer(geom_kiosk, 250)::geometry(Polygon, 32618)), '250', 'ctejeremie', NOW()::date 
FROM tbl_kiosk 
WHERE cte = 'ctejeremie' and status = 'functional' and type = 'private';

Upvotes: 1

Related Questions