我有两个查询,一个返回前 10 个最近的位置:
DECLARE @center GEOGRAPHY
SET @center = geography::Point(@Latitude, @Longitude, 4326)
SELECT TOP 10
[Physical_Address_Street]
, [Physical_Address_Local]
, [Physical_Address_State]
, [Physical_Address_Zip]
, [Phone_Number]
FROM Gas_Stations
WHERE Location_Type = 1
ORDER BY @center.STDistance(Location) ASC
然后另一个将获得通过的纬度和经度的距离
SELECT Location.STDistance(geography::Point(51, -2, 4326)) * 0.00062137119
FROM [MY_DB].[dbo].[Gas_Station]
这些都查询同一个表,那么我如何将它们组合起来并获得十个点中的每一个的距离?