joining a query with a select count(*)

From: Matthew Terenzio <matt(at)jobsforge(dot)com>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: joining a query with a select count(*)
Date: 2005-11-05 18:10:13
Message-ID: 14c2bdaff408ddf3dec1da51068f48d2@jobsforge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-11-05 18:47:31 Re: joining a query with a select count(*)
Previous Message Florian G. Pflug 2005-11-05 17:39:25 Missing variable "role" in "pg_settings"?