I want to get query for all UK members of global database.
I can use Ansi SQL and have regular expression support.
It's not mine to modify so I can't create tables in it and it's too big to geocode
SELECT
login,
location
FROM GLOBALDATA
where
(
lower( location) like '%united kingdom%' or
(lower( location) like '%england%'
and lower( location) not like '%new england%'
)
or
(lower( location) like '%london%'
and lower( location) not like 'london%on'
and lower( location) not like '%ontario%'
and lower( location) not like '%canada%'
)
or
(lower( location) like '%uk%'
and lower( location) not like '%breukelen%'
and lower( location) not like '%takatsuki%'
and lower( location) not like '%phuket%'
and lower( location) not like '%fukushima%'
and lower( location) not like '%ukarine%'
and lower( location) not like '%ukrain%'
...
and lower( location) not like '%ortenaukreis%'
and lower( location) not like '%takarazuka%'
and lower( location) not like '%mukwonago%'
and lower( location) not like '%ukrane%'
and lower( location) not like '%sukabumi%'
and lower( location) not like '%milwaukee%'
)
or
lower( location) like '%sussex%'
or
(lower( location) like '%bristol%'
-- ignore bristol, VA
and lower( location) not like '%va%'
)
-- uk towns
--
-- http://www.dangibbs.co.uk/journal/free-uk-postcode-towns-counties-database
--
or lower( location) like 'abbots langley%'
or lower( location) like 'abbotsham%'
or lower( location) like 'abenbury%'
or lower( location) like 'aberaeron%'
or lower( location) like 'abercarn%'
....
or lower( location) like 'yealmpton%'
or lower( location) like 'yeovil%'
or lower( location) like 'ystrad%'
or lower( location) like 'ystradgynlais%'
)
-- AND we DONT want
-- http://statetable.com/
--
and not
-- state codes
(
location like '%, AA'
or location like '%, AE'
or location like '%, AP'
...
or location like '%, VT'
or location like '%, WA'
or location like '%, WI'
or location like '%, WV'
or location like '%, WY'
-- also state names
or location like '%Alabama'
or location like '%Alaska'
or location like '%Arizona'
...
or location like '%Kingman Reef'
or location like '%Navassa Island'
or location like '%Serranilla Bank'
or location like '%Bajo Nuevo Bank'
)
My question is does anyone know if anyone has something more general purpose than this for other countries?
I cant find anything..