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
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
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
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
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
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?