Re: How can I group all children by their parent ? - Mailing list pgsql-general

From David G Johnston
Subject Re: How can I group all children by their parent ?
Date
Msg-id 1405604555571-5811851.post@n5.nabble.com
Whole thread Raw
In response to Re: How can I group all children by their parent ?  (Arup Rakshit <aruprakshit@rocketmail.com>)
List pgsql-general
Arup Rakshit wrote
> ORDER BY parent_id, id ?
>
> François Beausoleil
>
> parent_id .. But why order_by.. I thought I need to group by
>
> parent child email
>  1      2        

> test1@

>                 3        email

The word "group" as you have used it can mean:

"Generate a single record for each parent with all children combined into
that record."

or

"Physically order the output so that while each child still has its own
record all children of the same parent are listed consecutively"

The first solution requires GROUP BY, the second requires ORDER BY

It would help if you could show an example of what you want the output to
look like.

David J.






--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-can-I-group-all-children-by-their-parent-tp5811846p5811851.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Arup Rakshit
Date:
Subject: Re: How can I group all children by their parent ?
Next
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: How can I group all children by their parent ?