[OPEN-ILS-DEV] Evergreen SQL Help

Dan Wells dbw2 at calvin.edu
Tue Jan 19 21:45:44 EST 2010


That seems to do it.  Thanks Mike!  You are the best.

Sure looks simple, but I honestly wasn't even close.  I'll definitely commit this concept to memory for next time.

Dan

>>> Mike Rylander <mrylander at gmail.com> 01/19/10 9:09 PM >>>
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