I have a SQL Server 2012 location table, which has a column geo
of type geography
I have a user table which links to the location table
location
locationId int
geo geography
user
userId int
locationId int
I will know the id of the location and I know how to do a distance query with stdistance. But whats the best way of comparing the two distances in a query. I can do it with a subselect but is there a better way
The sub select looks something like
select
suburb, state, postcode,
geo.STDistance((select geo from location where locationId = 47))/1000 kms
from location
order by kms desc