X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E599930F67E for ; Mon, 23 Jun 2003 21:55:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 51100-04 for ; Mon, 23 Jun 2003 18:55:16 -0300 (ADT) Received: from t-9.net (unknown [64.246.36.43]) by svr1.postgresql.org (Postfix) with SMTP id 44F6530F55C for ; Mon, 23 Jun 2003 18:55:16 -0300 (ADT) Received: (qmail 29113 invoked by uid 0); 23 Jun 2003 18:59:52 -0000 Received: from localhost (HELO seahat.com) (127.0.0.1) by localhost with SMTP; 23 Jun 2003 18:59:52 -0000 Received: from 65.102.128.233 (SquirrelMail authenticated user snubber@seahat.com) by fordparts.com with HTTP; Mon, 23 Jun 2003 13:59:52 -0500 (CDT) Message-ID: <54717.65.102.128.233.1056394792.squirrel@fordparts.com> Date: Mon, 23 Jun 2003 13:59:52 -0500 (CDT) Subject: aggregate question From: "Ryan" To: X-Priority: 3 Importance: Normal X-Mailer: SquirrelMail (version 1.2.8) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=MSG_ID_ADDED_BY_MTA_3 X-Spam-Level: * X-Archive-Number: 200306/275 X-Sequence-Number: 14033 I know this one is simple enough. I have two tables: packages and package_log. paulsonsoft=# \d packages Table "public.packages" Column | Type | Modifiers -----------------+---------+------------------------------------------------------------------ package_name | text | not null package_desc | text | not null package_ver | text | not null package_date | text | not null package_loc | text | not null package_type | text | not null package_creator | text | package_status | boolean | default true package_id | integer | not null default nextval('public.packages_package_id_seq'::text) Indexes: packages_pkey primary key btree (package_id) Foreign Key constraints: $1 FOREIGN KEY (package_type) REFERENCES package_types(package_type) ON UPDATE CASCADE ON DELETE RESTRICT paulsonsoft=# \d package_log Table "public.package_log" Column | Type | Modifiers -------------+---------+----------------------------------------------------------------- custno | text | not null package_id | text | timestamp | text | not null ip_address | text | not null completed | boolean | current_ver | text | logo | text | licenses | text | log_id | integer | not null default nextval('public.package_log_log_id_seq'::text) Foreign Key constraints: $1 FOREIGN KEY (package_id) REFERENCES packages(package_id) ON UPDATE CASCADE ON DELETE RESTRICT I must be a total space case today because I can't hammer out the sql to get a listing of all the packages with a count() of the package_log by package_id. Thanks, Ryan