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

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: (view raw, whole thread or download thread mbox)
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?


pgsql-novice by date

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

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