pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Perrin <clists@perrin.socsci.unc.edu>
To: pgsql-sql@postgresql.org
Subject: Complicated "group by" question
Date: Wed, 25 Aug 2004 13:04:02 -0400 (EDT)
Message-ID: <Pine.LNX.4.53.0408251300580.20106@perrin.socsci.unc.edu> (raw)

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




view thread (5+ messages)  latest in thread

Message-ID: <Pine.LNX.4.53.0408251300580.20106@perrin.socsci.unc.edu>
Permalink:  ../Pine.LNX.4.53.0408251300580.20106@perrin.socsci.unc.edu/
Also on:    postgresql.org/message-id/Pine.LNX.4.53.0408251300580.20106@perrin.socsci.unc.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: clists@perrin.socsci.unc.edu
  Subject: Re: Complicated "group by" question
  In-Reply-To: <Pine.LNX.4.53.0408251300580.20106@perrin.socsci.unc.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox