Re: Stuck Up In My Own Category Tree

Поиск
Список
Период
Сортировка
От Don Parris
Тема Re: Stuck Up In My Own Category Tree
Дата
Msg-id CAJ-7yokatsLBvdMFrZA99BrpH6z_7CcFx=oO-tMHwaQYSmxPNg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Stuck Up In My Own Category Tree  ("Edward W. Rouse" <erouse@comsquared.com>)
Список pgsql-sql
On Thu, Aug 11, 2011 at 12:48, Edward W. Rouse <erouse@comsquared.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
GPG Key ID: F5E179BE

В списке pgsql-sql по дате отправления:

Предыдущее
От: "Edward W. Rouse"
Дата:
Сообщение: Re: Stuck Up In My Own Category Tree
Следующее
От: tlund79
Дата:
Сообщение: Using variables in select