Created
August 19, 2013 19:54
-
-
Save blackjk3/6273329 to your computer and use it in GitHub Desktop.
Database statements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ID , stop_name, ST_Distance_Sphere( | |
ST_GeomFromText('POINT(' || stop_lon || ' ' || stop_lat || ')'), | |
ST_GeomFromtext('POINT(-93.2446454 44.9723784)') | |
), stop_lat, stop_lon | |
FROM STOPS | |
order by 3 | |
limit 10; | |
insert into stops | |
(stop_code, stop_name, stop_desc, stop_lat, stop_lon, zone_id, stop_street, stop_city, stop_region, stop_postcode, stop_country) | |
SELECT | |
external_stop_id, external_stop_name, external_stop_desc,external_lat, external_lon, external_zone_id, | |
external_stop_street, external_stop_city, external_stop_region, external_stop_postcode, external_stop_country | |
FROM source_stops; | |
update source_stops set stop_id = (SELECT ID FROM STOPS WHERE STOP_CODE = EXTERNAL_STOP_ID); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment