Re: [SQL] Stuck Up In My Own Category Tree

2011-08-11 Thread Don Parris
On Thu, Aug 11, 2011 at 12:48, Edward W. Rouse 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 start

Re: [SQL] Stuck Up In My Own Category Tree

2011-08-11 Thread Edward W. Rouse
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

Re: [SQL] Stuck Up In My Own Category Tree

2011-08-11 Thread jasmin . dizdarevic
I will have do something like this soon. Look at ltree. I don't have much experience with it yet, but it seems that this ext addresses those issues. Regards A1 präsentiert BlackBerry® von Vodafone -Original Message- From: Samuel Gendler Sender: pgsql-sql-owner@postgresql.orgDate: Thu, 11

Re: [SQL] Stuck Up In My Own Category Tree

2011-08-11 Thread Samuel Gendler
On Thu, Aug 11, 2011 at 8:39 AM, Don Parris wrote: > Hi all, > > Note: I'm happy to read howtos, tutorials, archived messages - I just > haven't found anything that addresses this yet. I found a related topic on > the novice list, but my post got no response there. I've been struggling > with t

[SQL] Stuck Up In My Own Category Tree

2011-08-11 Thread Don Parris
Hi all, Note: I'm happy to read howtos, tutorials, archived messages - I just haven't found anything that addresses this yet. I found a related topic on the novice list, but my post got no response there. I've been struggling with this for about a week now and need to figure out a solution. Hec