Postgres - Subtraction of two queries
The following query will join a one-row result set against a many row result set, and allow them to be compared.
SELECT a.*, b.*, a.distance_km - b.distance_kn AS differenceFROM( SELECT ST_Y(ST_Centroid(ST_Collect(column1))) AS distance_km FROM table1) aCROSS JOIN( SELECT ST_Y(ST_Transform(column1,4326)) AS distance_km FROM table1) b