SELECT query

From: "G(dot) Anthony Reina" <reina(at)nsi(dot)edu>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgreSQL(dot)org>
Subject: SELECT query
Date: 2001-03-14 19:13:53
Message-ID: 3AAFC2F1.AEEAAFB2@nsi.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I can't figure out how to make the following query:

Table = circles_proc

subject text,
arm char,
rep int,
cycle int

I'd like to find the unique subject, arm, and rep tuples where the rep
has exactly 5 cycles associated with it.

I think it would be something like:
select distinct subject, arm, rep from circles_proc where rep = (select
rep from circles_proc where 5 = count(cycle));

but the count is going to be performed over all tuples returned. I'd
like to have the count performed over each rep and just find the reps
where there are 5 cycles.

Can someone help?
Thanks.
-Tony

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Eric Frazier 2001-03-14 22:21:12 Which is faster, create index after many inserts or before?
Previous Message Jeff Daugherty 2001-03-14 18:34:05 Re: relation problem