I have code written in postgreSQL database:
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 ;
and instead of 'POINT(-72.1235 42.3521)' and LINESTRING(-72.1260 42.45, -72.123 42.1546)' I want to add a point which is selected from table:
SELECT ST_asText(geog) FROM punkty WHERE gid = 1
How to add a selected variable into string in psql database?