From: | Don Parris <parrisdc(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Stuck Up In My Own Category Tree |
Date: | 2011-08-11 21:21:23 |
Message-ID: | CAJ-7yokatsLBvdMFrZA99BrpH6z_7CcFx=oO-tMHwaQYSmxPNg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, Aug 11, 2011 at 12:48, Edward W. Rouse <erouse(at)comsquared(dot)com>wrote:
> How about SELECT cat_name, sum(amount) AS "amount" FROM category,
> trans_details WHERE category_cat_id in (select cat_id from category where
> lineage ~ ‘^1’)****
>
> ** **
>
> Where the in clause is basically, the cat_id where lineage starts with, and
> then the lineage you want. 1, 1-2, whatever the lineage is. Not sure about
> efficiency or whether you can put another subselect in there to build the
> lineage string to match, but the basic idea should work. ****
>
> ** **
>
> *
> *
>
Thanks all, I will try out the suggestions. Samuel, thanks for the link!
Haven't had a chance to check it out yet, but it sure looks promising.
I'll post again when I've had a chance to look over/ try out some of these
things. :-)
Don
--
D.C. Parris, FMP, LEED AP O+M, ESL Certificate
Minister, Security/FM Coordinator, Free Software Advocate
https://www.xing.com/profile/Don_Parris |
http://www.linkedin.com/in/dcparris
GPG Key ID: F5E179BE
From | Date | Subject | |
---|---|---|---|
Next Message | tlund79 | 2011-08-12 11:05:37 | Using variables in select |
Previous Message | Edward W. Rouse | 2011-08-11 16:48:35 | Re: Stuck Up In My Own Category Tree |