Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U9Hld-00086V-Kl for pgsql-sql@arkaria.postgresql.org; Sat, 23 Feb 2013 16:16:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U9Hlc-0003fc-Fz for pgsql-sql@arkaria.postgresql.org; Sat, 23 Feb 2013 16:16:04 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U9HlT-0003XF-2Q for pgsql-sql@postgresql.org; Sat, 23 Feb 2013 16:15:55 +0000 Received: from tx2ehsobe005.messaging.microsoft.com ([65.55.88.15] helo=tx2outboundpool.messaging.microsoft.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U9HlR-0000Fl-GF for pgsql-sql@postgresql.org; Sat, 23 Feb 2013 16:15:54 +0000 Received: from mail64-tx2-R.bigfish.com (10.9.14.238) by TX2EHSOBE009.bigfish.com (10.9.40.29) with Microsoft SMTP Server id 14.1.225.23; Sat, 23 Feb 2013 16:15:49 +0000 Received: from mail64-tx2 (localhost [127.0.0.1]) by mail64-tx2-R.bigfish.com (Postfix) with ESMTP id 2203F80160; Sat, 23 Feb 2013 16:15:49 +0000 (UTC) X-Forefront-Antispam-Report: CIP:157.56.240.245; KIP:(null); UIP:(null); IPV:NLI; H:BL2PRD0210HT002.namprd02.prod.outlook.com; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: PS0(zzzz1f42h1d77h1ee6h1de0h1202h1e76h1d1ah1d2ahz8dhzz2fh2a8h668h839h947hd25he5bhf0ah1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh162dh1631h1758h18e1h1946h19b5h1155h) Received-SPF: pass (mail64-tx2: domain of uga.edu designates 157.56.240.245 as permitted sender) client-ip=157.56.240.245; envelope-from=nuse@uga.edu; helo=BL2PRD0210HT002.namprd02.prod.outlook.com ; .outlook.com ; Received: from mail64-tx2 (localhost.localdomain [127.0.0.1]) by mail64-tx2 (MessageSwitch) id 1361636146431600_23613; Sat, 23 Feb 2013 16:15:46 +0000 (UTC) Received: from TX2EHSMHS007.bigfish.com (unknown [10.9.14.250]) by mail64-tx2.bigfish.com (Postfix) with ESMTP id 6547BF0004A; Sat, 23 Feb 2013 16:15:46 +0000 (UTC) Received: from BL2PRD0210HT002.namprd02.prod.outlook.com (157.56.240.245) by TX2EHSMHS007.bigfish.com (10.9.99.107) with Microsoft SMTP Server (TLS) id 14.1.225.23; Sat, 23 Feb 2013 16:15:46 +0000 Received: from BL2PRD0210MB386.namprd02.prod.outlook.com ([169.254.5.128]) by BL2PRD0210HT002.namprd02.prod.outlook.com ([10.255.106.165]) with mapi id 14.16.0263.000; Sat, 23 Feb 2013 16:15:45 +0000 From: Bryan L Nuse To: Don Parris CC: "pgsql-sql@postgresql.org" Subject: Re: Summing & Grouping in a Hierarchical Structure Thread-Topic: [SQL] Summing & Grouping in a Hierarchical Structure Thread-Index: AQHOCyAJwSsJ7FlVmkKBmoOj7F52WZiFn+UAgAD/jACAACvkAIAAIgMAgAC3dACAAAcGAA== Date: Sat, 23 Feb 2013 16:15:45 +0000 Message-ID: <7BEBA741-E416-4000-BE2D-B9196683A2A4@uga.edu> References: <8A586FDE-CC0A-4F26-AD19-1F89C2D9349E@uga.edu> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.106.132] Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uga.edu X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org > That said, now that I have finally gotten the chance to try ltree, I thi= nk I like it a lot.=20 Hello Don, Yes, after looking at ltree --which I had not done before-- I have to agree= with Misa that it looks like the right solution for your problem. That is= not to say that "brute force" SQL couldn't provide a workable arrangement;= but ltree looks very flexible, especially as it allows you to assign cost = values to non-terminal nodes. If it were me, though, I'd still make use of= VIEWs to report results of the workhorse queries: staring at a list of it= ems like "Transportation.Bicycle.Gear.Chain_ring" sounds like headache. Th= at's a matter of taste, of course. Bryan --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql