SELECT ST_Distance(USER_POLY, NEW_LOC) as dist
FROM (
SELECT (select ST_transform(ST_SetSRID(ST_MakePoint( 11.61594943945313, 48.12707189053979),4326),3857)) AS RES_LOC,
(SELECT ST_Transform((select u.poly
FROM USERS u
WHERE u.user_id = '83b71cee-e9b8-46cb-9bee-6d7ee6f44cc6'), 3857)) AS USER_POLY
) AS foo
I have tried the query in the cli and it worked once I removed the as dist but using node I get the error: syntax error at or near "SELECT", I tried casting but to no avail.