X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4B4CE5E46DC for ; Wed, 25 Aug 2004 14:04:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57080-06 for ; Wed, 25 Aug 2004 17:04:50 +0000 (GMT) Received: from smtp.unc.edu (smtpsrv10.isis.unc.edu [152.2.1.241]) by svr1.postgresql.org (Postfix) with ESMTP id 57D785E3631 for ; Wed, 25 Aug 2004 14:04:50 -0300 (ADT) Received: from perrin.socsci.unc.edu (mail@perrin.socsci.unc.edu [152.2.242.197]) by smtp.unc.edu (8.12.9/8.12.9) with ESMTP id i7PH40hX016448 for ; Wed, 25 Aug 2004 13:04:01 -0400 (EDT) Received: from clists (helo=localhost) by perrin.socsci.unc.edu with local-esmtp (Exim 3.36 #1 (Debian)) id 1C01Bq-0005Ie-00 for ; Wed, 25 Aug 2004 13:04:02 -0400 Date: Wed, 25 Aug 2004 13:04:02 -0400 (EDT) From: Andrew Perrin To: pgsql-sql@postgresql.org Subject: Complicated "group by" question Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/264 X-Sequence-Number: 18761 I have a table of people ("reviewers"), a table of review assignments ("assign"), and a table of review acceptances ("accept"). I would like to be able to write a query to return the latest (e.g., max(assign_date)) assignment for each reviewer, plus the acc_id field from "accept". I think I should be able to do this with a GROUP BY clause, but am having no luck. Table structure: reviewers assign accept ----------------------------------------- reviewer_id assign_id accept_id reviewer_id assign_id ... assign_date ... ... Thanks for any guidance. Andy ---------------------------------------------------------------------- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu