Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tjmgis/6990315 to your computer and use it in GitHub Desktop.
Save tjmgis/6990315 to your computer and use it in GitHub Desktop.
SQL query for finding Parent_Child_Grandchild records from OS AddressBase Premium
SELECT parent_uprn FROM addressbasepremium.delivery_geo_plus WHERE parent_uprn IS NOT NULL and multi_occ > 0 and geo_uprn IN
(SELECT parent_uprn FROM addressbasepremium.delivery_geo_plus where parent_uprn IS NOT NULL and multi_occ > 0 and geo_uprn IN
(SELECT parent_uprn FROM addressbasepremium.delivery_geo_plus WHERE parent_uprn IS NOT NULL and multi_occ = 0)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment