0

I am using SSMS for SQL Server Express 2019.

I am trying to find a way to classify a set of geographic locations by comparing their distance to a set of reference points.

Table A includes a column of location names Name and a column of geography points glocation.

Table B includes the same type of columns Name and glocation but has an additional column that has an identifier that is either A, B, C, D or E.

I want to add 3 new columns to Table A with the Name of the closest city from table B, the classification from A-E from the closet city, and the distance in kilometres from that city.

Output Example:

Name, glocation, Closest City, Distance, Class
---------------------------------------------------
City1  0xE61...  City5         362.123   E

I'm an SQL noob and would appreciate any guidance on this...

Matt
  • 1

0 Answers0