Re: Summing & Grouping in a Hierarchical Structure

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: Don Parris <parrisdc(at)gmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Summing & Grouping in a Hierarchical Structure
Date: 2013-02-22 09:00:34
Message-ID: CAH3i69moWcM9-mxaK5oiiY3o96X0V82QOyjXVDb2Jb-KrDQjog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Have you considered maybe ltree datatype?

http://www.postgresql.org/docs/9.1/static/ltree.html

I think it solves a lot of problems in topic....

Kind regards,

Misa

On Friday, February 15, 2013, Don Parris wrote:

> Hi all,
>
> I posted to this list some time ago about working with a hierarchical
> category structure. I had great difficulty with my problem and gave up
> for a time. I recently returned to it and resolved a big part of it. I
> have one step left to go, but at least I have solved this part.
>
> Here is the original thread (or one of them):
>
> http://www.postgresql.org/message-id/CAJ-7yonw4_qDCp-ZNYwEkR2jdLKeL8nfGc+-TLLSW=Rmo1VkbA@mail.gmail.com
>
> Here is my recent blog post about how I managed to show my expenses summed
> and grouped by a mid-level category:
> http://dcparris.net/2013/02/13/hierarchical-categories-rdbms/
>
>
> Specifically, I wanted to sum and group expenses according to categories,
> not just at the bottom tier, but at higher tiers, so as to show more
> summarized information. A CEO primarily wants to know the sum total for
> all the business units, yet have the ability to drill down to more detailed
> levels if something is unusually high or low. In my case, I could see the
> details, but not the summary. Well now I can summarize by what I refer to
> as the 2nd-level categories.
>
> Anyway, I hope this helps someone, as I have come to appreciate - and I
> mean really appreciate - the challenge of working with hierarchical
> structures in a 2-dimensional RDBMS. If anyone sees something I should
> explain better or in more depth, please let me know.
>
> Regards,
> Don
> --
> D.C. Parris, FMP, Linux+, ESL Certificate
> Minister, Security/FM Coordinator, Free Software Advocate
> http://dcparris.net/ <https://www.xing.com/profile/Don_Parris><http://www.linkedin.com/in/dcparris>
> GPG Key ID: F5E179BE
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Russell Keane 2013-02-22 09:26:21 Re: need help
Previous Message Russell Keane 2013-02-22 08:31:26 Re: need help