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

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: How can I group all children by their parent ?
Дата
Msg-id 1405604555571-5811851.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: How can I group all children by their parent ?  (Arup Rakshit <aruprakshit@rocketmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Arup Rakshit
Дата:
Сообщение: Re: How can I group all children by their parent ?
Следующее
От: "D'Arcy J.M. Cain"
Дата:
Сообщение: Re: How can I group all children by their parent ?