我在postgresql数据库中编写了代码:
SELECT ST_Distance(gg1, gg2) As spheroid_dist, ST_Distance(gg1, gg2, false) As sphere_dist
FROM (SELECT
'SRID=4326;POINT(-72.1235 42.3521)'::geography as gg1,
'SRID=4326;LINESTRING(-72.1260 42.45, -72.123 42.1546)'::geography as gg2
) As foo ;
而不是'point(-72.1235 42.3521)'和linestring(-72.1260 42.45,-72.123 42.1546)'我想添加一个从表中选择的点:
SELECT ST_asText(geog) FROM punkty WHERE gid = 1
如何将所选变量添加到psql数据库的字符串中?
1条答案
按热度按时间doinxwow1#
欢迎来到so。
我可能过于简化了您的问题,但只要在where子句中添加两个表或一个join(如果可能的话)就可以了。
例子: