【问题标题】:Is there a way to run one query instead of those two in PosgreSQL/PostGIS有没有办法在 PostgreSQL/PostGIS 中运行一个查询而不是这两个
【发布时间】:2020-09-30 19:44:23
【问题描述】:

第一个查询是:

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());

谢谢

【问题讨论】:

  • 您想将第一个查询嵌套在您使用过geom的第二个查询中?
  • 是的,但我找到了解决方案。我编译了第二个和第一个: 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';

标签: sql postgresql postgis


【解决方案1】:
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';

【讨论】:

    猜你喜欢
    • 2021-11-01
    • 1970-01-01
    • 2020-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-19
    • 2019-06-14
    相关资源
    最近更新 更多