joining a query with a select count(*) - Mailing list pgsql-general

From Matthew Terenzio
Subject joining a query with a select count(*)
Date
Msg-id 14c2bdaff408ddf3dec1da51068f48d2@jobsforge.com
Whole thread Raw
Responses Re: joining a query with a select count(*)  (Martijn van Oosterhout <kleptog@svana.org>)
Re: joining a query with a select count(*)  (John Sidney-Woollett <johnsw@wardbrook.com>)
List pgsql-general
I want a query to return all the rows from one table along with a count
of rows in another table that reference each returned row from the
first table.

For instance, if you had a table of children and another table of
grandchildren that had a foreign key on the children table, I'd want to
return all children with a count of the number of kids they had.

I hope I can figure it out before I get a reply.

Thanks


pgsql-general by date:

Previous
From: "Florian G. Pflug"
Date:
Subject: Missing variable "role" in "pg_settings"?
Next
From: Martijn van Oosterhout
Date:
Subject: Re: joining a query with a select count(*)