[OPEN-ILS-DEV] Evergreen SQL Help
Mike Rylander
mrylander at gmail.com
Tue Jan 19 21:09:13 EST 2010
On Tue, Jan 19, 2010 at 6:32 PM, Dan Wells <dbw2 at calvin.edu> wrote:
> Hello,
>
> Let me start by saying SQL is not my strong suit, and Postgres makes it even weaker. What I am trying to do is write a single Postgres query/function which returns all of a user's work_ous and their ancestors without duplicates. I see that actor.org_unit_ancestors() is there, and selecting the work_ous is simple enough, but how can one combine them into a single result set? It seems relatively simple, but I just can't get it right.
>
How about:
select distinct (actor.org_unit_ancestors(work_ou)).id from
permission.usr_work_ou_map where usr = XXX;
--
Mike Rylander
| VP, Research and Design
| Equinox Software, Inc. / The Evergreen Experts
| phone: 1-877-OPEN-ILS (673-6457)
| email: miker at esilibrary.com
| web: http://www.esilibrary.com
More information about the Open-ils-dev
mailing list