Skip to content

Instantly share code, notes, and snippets.

@jeff
Last active December 16, 2015 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeff/fb9991eaea4b887243b4 to your computer and use it in GitHub Desktop.
Save jeff/fb9991eaea4b887243b4 to your computer and use it in GitHub Desktop.
SELECT
au.id,
asceum1.stat_cat_entry AS location_home,
asceum2.stat_cat_entry AS location_property_tax
FROM actor.usr au
LEFT JOIN actor.stat_cat_entry_usr_map asceum1 ON (asceum1.stat_cat = 41 AND au.id = asceum1.target_usr) -- Location - Home
LEFT JOIN actor.stat_cat_entry_usr_map asceum2 ON (asceum2.stat_cat = 62 AND au.id = asceum2.target_usr) -- Location - Property Tax
WHERE au.home_ou IN (SELECT id FROM actor.org_unit_descendants(22))
ORDER BY au.id
LIMIT 1000;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment