SELECT query

Поиск
Список
Период
Сортировка
От G. Anthony Reina
Тема SELECT query
Дата
Msg-id 3AAFC2F1.AEEAAFB2@nsi.edu
обсуждение исходный текст
Ответы Re: SELECT query  (Joel Burton <jburton@scw.org>)
Список 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 по дате отправления:

Предыдущее
От: Jeff Daugherty
Дата:
Сообщение: Re: relation problem
Следующее
От: Eric Frazier
Дата:
Сообщение: Which is faster, create index after many inserts or before?