WITH Distance AS ( SELECT "Scenic_Id",ST_DISTANCE_SPHERE(ST_MAKEPOINT("Scenic_Lon","Scenic_Lat"),ST_MAKEPOINT(104.036058,30.666089)) AS "Length" FROM "tbScenics" WHERE "Scenic_Lat">20.001 AND "Scenic_Lat"<50.001 AND "Scenic_Lon">80.001 AND "Scenic_Lon"<105.001 ORDER BY "Length" ASC) SELECT "tbScenics".*,"Length","Length" /10 FROM "tbScenics",Distance WHERE Distance."Scenic_Id"="tbScenics"."Scenic_Id" ORDER BY "Length" ASC; SELECT "tbScenics".*,30.666089)) AS "Length",30.666089))/10 FROM "tbScenics" WHERE "Scenic_Lat">20.001 AND "Scenic_Lat"<50.001 AND "Scenic_Lon">80.001 AND "Scenic_Lon"<105.001 ORDER BY "Length" ASC; 原文链接:https://www.f2er.com/postgresql/194826.html