SELECT query - Mailing list pgsql-novice

From G. Anthony Reina
Subject SELECT query
Date
Msg-id 3AAFC2F1.AEEAAFB2@nsi.edu
Whole thread Raw
Responses Re: SELECT query
List 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



pgsql-novice by date:

Previous
From: Jeff Daugherty
Date:
Subject: Re: relation problem
Next
From: Eric Frazier
Date:
Subject: Which is faster, create index after many inserts or before?