如何在 SQL 服务器上使用语法

How use syntax on SQL Server

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

我需要在 SQL 服务器上进行此查询:

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)

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

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

以后可以像这样转换成更新:

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

您可以在MS Docs.

上找到所有信息