Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux