Complicated "group by" question - Mailing list pgsql-sql

From Andrew Perrin
Subject Complicated "group by" question
Date
Msg-id Pine.LNX.4.53.0408251300580.20106@perrin.socsci.unc.edu
Whole thread Raw
Responses Re: Complicated "group by" question
Re: Complicated "group by" question
Re: Complicated "group by" question
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Jan Wieck
Date:
Subject: Re: PQexec and SPI_exec
Next
From: Josh Berkus
Date:
Subject: Re: Complicated "group by" question