Select Rows With Only One of Two Values

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Select Rows With Only One of Two Values
Дата
Msg-id alpine.LNX.2.00.1207200844110.21688@salmo.appl-ecosys.com
обсуждение исходный текст
Ответы Re: Select Rows With Only One of Two Values  (Chris Angelico <rosuav@gmail.com>)
Список pgsql-general
   What I thought would be a simple, single table select keeps eluding me.
I've looked in Rick van der Laans' book and the Joe Celko books here and
have not learned how to write the query.

   The table has a Boolean indicator column with values of 0 or 1 for each
row in the table and another attribute column for parameter names. I need to
find all parameter names where the indicator value is only 0 for all rows of
that parameter. At least some of the parameters have both rows with 0 and
rows with 1 in the indicator attribute. I want to find all (any?) that have
only zeros.

   I have tried various flavors of this non-working syntax:

SELECT DISTINCT(param) from table WHERE indicator = 0 and indicator <> 1
order by param;

and have not found the correct way of writing this either directly or as a
correlated query. The proper syntax must not be complicated and I would
appreciate learning how to write it.

Rich


В списке pgsql-general по дате отправления:

Предыдущее
От: Christian Ullrich
Дата:
Сообщение: Re: I cannot insert bengali character in UTF8
Следующее
От: Chris Angelico
Дата:
Сообщение: Re: Select Rows With Only One of Two Values