Re: Select number of children of a parent query

From: "Joost Kraaijeveld" <J(dot)Kraaijeveld(at)Askesis(dot)nl>
To: "John Sidney-Woollett" <johnsw(at)wardbrook(dot)com>
Cc: "Pgsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select number of children of a parent query
Date: 2005-01-02 19:45:46
Message-ID: A3D1526C98B7C1409A687E0943EAC41001EB1F@obelix.askesis.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi John,

John Sidney-Woollett schreef:
> Useful to add a title to your messages before you post...
It escaped before finishing.....

> How about:
>
> select parentid, count(*) as number_of_children
> from childtable
> group by parentid
> order by parentid;
It works but can you tell me why this works? Is the count(*) over the "group by parentid"?


Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J(dot)Kraaijeveld(at)Askesis(dot)nl
web: www.askesis.nl

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2005-01-02 20:56:52 Re: Function Parameters
Previous Message Tom Lane 2005-01-02 18:58:00 Re: OS X shared memory problems 8.0rc3