# this subselect is very slow even on MySQL 5
select concat(address, ', ', post_code), practice_id
from community_monitoring.gp_practices
where practice_id in (
select distinct(practice_code)
from hilis3.Main m left join hilis3.GP g on g.g_id = m.Clinician
where Clinician like 'G%' and g_id <> 'G1'
)
export to XL file, import XL file into referral_sources table
update referral_sources set location_type = 'practice' where organisation_code like 'B_____'
add default unknown practice code