提供一个简单的语法问题,但是我有一个postGIS查询,希望在单个表上运行:
SELECT
ST_Overlaps(g1.geom,g2.geom) AS asr_01
FROM
ch03.my_polygons g1, ch03.my_polygons g2
WHERE
g1.agent_type = 0 AND g2.agent_type != 0 AND g1.sim_time = 0.0
可以按预期工作,但我也想选择一个相邻的列,例如
SELECT
agent_id
FROM
ch03.my_polygons
WHERE
agent_type != 0
它也可以正常工作,但是如何将它们结合起来?试过这个...
SELECT
agent_id,
ST_Overlaps(g1.geom,g2.geom) AS asr_01
FROM
ch03.my_polygons,
ch03.my_polygons g1, ch03.my_polygons g2
WHERE
agent_type != 0,
g1.agent_type = 0 AND g2.agent_type != 0 AND g1.sim_time = 0.0
可能吗?解决这个问题的另一种方法?谢谢
答案 0 :(得分:0)
好的,我通过结合使用变量来解决了...
SELECT
g2.agent_id,
ST_Overlaps(g1.geom,g2.geom) AS asr_01
FROM
ch03.my_polygons g1, ch03.my_polygons g2
WHERE
g1.agent_type = 0 AND g2.agent_type != 0 AND g1.sim_time = 0.0