Re: How can I group all children by their parent ?

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Arup Rakshit <aruprakshit(at)rocketmail(dot)com>
Cc: François Beausoleil <francois(at)teksol(dot)info>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How can I group all children by their parent ?
Date: 2014-07-17 13:48:53
Message-ID: 20140717094853.041ae078@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 17 Jul 2014 21:28:14 +0800
Arup Rakshit <aruprakshit(at)rocketmail(dot)com> wrote:
> ORDER BY parent_id, id ?

> parent_id .. But why order_by.. I thought I need to group by

Perhaps you need to tell us what your problem is instead of your
solution. What exactly are you trying to accomplish here? Don't
describe it in database terms. Tell us what the real world situation
is and what result you want to see. For example;

I have a list of people related to each other in a parent/child
relationship to any level (e.g. parents, grandparents, etc.) and I want
to list everyone who is a descendant of anyone in the database.

Try for that level of detail and you will probably get more useful
answers. Also, see http://www.catb.org/~esr/faqs/smart-questions.html
for some useful hints on asking questions.

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner.
IM: darcy(at)Vex(dot)Net, VoIP: sip:darcy(at)druid(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-07-17 14:10:11 Re: Why pg_toast table not get auto vacuumed?
Previous Message David G Johnston 2014-07-17 13:42:35 Re: How can I group all children by their parent ?