Skip site navigation (1) Skip section navigation (2)

Complicated "group by" question

From: Andrew Perrin <clists(at)perrin(dot)socsci(dot)unc(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Complicated "group by" question
Date: 2004-08-25 17:04:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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

Table structure:

reviewers	assign		accept
reviewer_id	assign_id	accept_id
		reviewer_id	assign_id
...		assign_date
		...		...

Thanks for any guidance.


Andrew J Perrin -
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists(at)perrin(dot)socsci(dot)unc(dot)edu * andrew_perrin (at)


pgsql-sql by date

Next:From: Josh BerkusDate: 2004-08-25 17:47:18
Subject: Re: Complicated "group by" question
Previous:From: Jan WieckDate: 2004-08-25 14:53:33
Subject: Re: PQexec and SPI_exec

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group