[GENERAL] How can I group all children by their parent ?

2014-07-17 Thread Arup Rakshit
How can I group all children by their parent ?  id email parent_id 1 t...@test.com nil 2 te...@test.com 1 3 email 1 4 email 2 5 email nil 6 email 3   Regards, Arup Rakshit

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

2014-07-17 Thread François Beausoleil
Le 2014-07-17 à 09:08, Arup Rakshit arupraks...@rocketmail.com a écrit : How can I group all children by their parent ? id email parent_id 1 t...@test.com nil 2 te...@test.com 1 3 email 1 4 email 2 5 email nil 6 email 3

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

2014-07-17 Thread Pujol Mathieu
Le 17/07/2014 15:08, Arup Rakshit a écrit : How can I group all children by their parent ? id email parent_id 1 t...@test.com nil 2 te...@test.com 1 3 email 1 4 email 2 5 email nil 6 email 3 Regards, Arup Rakshit Did you mean SELECT array_agg(id), array_agg(email), parent_id FROM ... GROUP BY

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

2014-07-17 Thread Arup Rakshit
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        te...@test.com                 3        email

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

2014-07-17 Thread David G Johnston
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

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

2014-07-17 Thread D'Arcy J.M. Cain
On Thu, 17 Jul 2014 21:28:14 +0800 Arup Rakshit arupraks...@rocketmail.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?