[OPEN-ILS-DEV] Evergreen SQL Help

Bill Ott bott at grpl.org
Wed Jan 20 12:00:15 EST 2010


This seems like the perfect place to mention that Mike will be 
presenting "Evergreen SQL 101" at the 2010 Evergreen Conference 
(http://www.evergreen2010.org).  Look for a full schedule of 
presentations coming out in the very near future!




Dan Wells said the following on 01/19/2010 09:45 PM:
> 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;
>
>    


More information about the Open-ils-dev mailing list