首页 > 解决方案 > 有没有办法在 PosgreSQL/PostGIS 中运行一个查询而不是这两个

问题描述

第一个查询是:

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';

第二个查询是:

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

谢谢

标签: sqlpostgresqlpostgis

解决方案


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';

推荐阅读