Given the following table structure
Locations
LocationName|Easting|Northing
Incidents
LocationString|Easting|Northing|LocationName
LocationString is a badly formatted Subway Station Name that the user of the application can type any old rubbish in to. The eastings and Northings (Co-ordinates) are consistent however. Using them i can give the location a consistent name by looking those values up in a look up table.
In ACCESS SQL i would do the following
UPDATE INCIDENTS, Locations
SET Incidents.LocationName = Locations.LocationsName
WHERE Incidents.Easting = Locations.Easting
AND
Incidents.Northing = Locations.Northing
How do i acc开发者_如何学JAVAomplish the same in T-SQL?
UPDATE I
SET I.LocationName = L.LocationsName
FROM Incidents I
JOIN Locations L
ON I.Easting = L.Easting AND I.Northing = L.Northing
精彩评论