Create Lookup table
CREATE TABLE lookup.lookup
(
location character varying(80),
locality character varying(80),
eastings numeric(10,0),
northings numeric(10,0)
)
WITH (
OIDS=FALSE
);
INSERT INTO lookup.lookup (location,locality,eastings,northings) SELECT name,locality,centx,centy FROM locator.os_locator WHERE name IS NOT NULL and classifica IS NULL;
INSERT INTO lookup.lookup (location,locality,eastings,northings) SELECT classifica,locality,centx,centy FROM locator.os_locator WHERE name IS NULL and classifica IS NOT NULL;
INSERT INTO lookup.lookup (location,locality,eastings,northings) SELECT name,locality,centx,centy FROM locator.os_locator WHERE name IS NOT NULL and classifica IS NOT NULL;
INSERT INTO lookup.lookup (location,locality,eastings,northings) SELECT classifica,locality,centx,centy FROM locator.os_locator WHERE name IS NOT NULL and classifica IS NOT NULL;
INSERT INTO lookup.lookup (location,locality,eastings,northings) SELECT def_nam,full_count,east,north FROM gazetteer.gaz2012;
INSERT INTO lookup.lookup (location,eastings,northings) SELECT postcode,eastings,northings FROM codept_open.codept_open;
COPY lookup.lookup to 'C:/temp/lookup.csv' delimiters',';
Updated less than a minute ago