如何在SQL Server上使用语法

时间:2019-04-17 18:07:51

标签: sql-server pgadmin

我是pgadmin的用户...我对空间连接的SQL Server语法有疑问。

我需要在SQL Server上执行以下查询:

select * 
from table a, table b
where st_within (st_centroid(a.geom), b.geom)

update table a 
set x = b.x
from table b
where st_within (st_centroid(a.geom), b.geom)

1 个答案:

答案 0 :(得分:0)

我相信您可能需要这样的东西:

SELECT * 
FROM table a
JOIN table b ON a.geom.STCentroid().STWithin( b.geom) = 1;

可以稍后将其转换为UPDATE:

UPDATE a 
SET x = b.x
FROM table a
JOIN table b ON a.geom.STCentroid().STWithin( b.geom) = 1;

您可以在MS Docs.

上找到所有信息。