Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +--------+-------------+-------------+-------+---------+
- | ADD_ID | Longitude | Latitude | Range | Address |
- +--------+-------------+-------------+-------+---------+
- | 1 | 72.03092000 | 33.28729000 | 50 | abcd |
- +--------+-------------+-------------+-------+---------+
- +--------+-------------+-------------+
- | Cor_id | Co_Lat | Co_GLng |
- +--------+-------------+-------------+
- | 8450 | 72.03092011 | 33.28729005 |
- | 8451 | 73.03099001 | 32.28729901 |
- +--------+-------------+-------------+
- +--------+-------------+-------------+-------------------------+
- | Cor_id | Co_Lat | Co_GLng | Address |
- +--------+-------------+-------------+-------------------------+
- | 8450 | 72.03092011 | 33.28729005 | abcd |
- | 8451 | 73.03099001 | 32.28729901 | 73.03099001,32.28729901 |
- +--------+-------------+-------------+-------------------------+
- SELECT
- CT.Id,
- CT.Co_Lat,
- CT.Co_GLng,
- [Address] = COALESCE(AD.[Address],cast(CT.Co_Lat as varchar(50))+','+cast(CT.Co_GLng as varchar(50)),'')
- FROM Coordinate_Table CT
- LEFT JOIN Address_Table AD
- ON CT.Co_Lat BETWEEN AD.Longitude+0.00000005 AND AD.Longitude-0.00000005
- AND CT.Co_GLng BETWEEN AD.Latitude+0.00000005 AND AD.Latitude-0.00000005
Add Comment
Please, Sign In to add comment