SQL newbie question:

Поиск
Список
Период
Сортировка
От ve3ey@rac.ca
Тема SQL newbie question:
Дата
Msg-id 20021216180416.12520.qmail@mail.fireroute.com
обсуждение исходный текст
Ответы Re: SQL newbie question:  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-novice
Hi Everyone:

I have a table with two columns:  names and band .   There are about 50000
names in "names" column and five bands (1-5)in the "band" column.    Each
name can belong to one, more than one or all 5 bands.  Something like:

names         band
___________________

jim            2
john           1
mark           4
jim            4

Etc, etc...

I am trying to figure out how many names (out of 50000) are members of , say
, all 5 bands or only 4  bands etc.  That is , for example, how many unique
names I have in , say, bands 1 and 2 and 3
I tried something like this:

SELECT COUNT (names) FROM <my table> WHERE band = 1 AND band = 2 AND band =
3;

So , the above select statement was supposed to tell me how many users
belong to band 1,2 and 3.   I am always getting result of "0" but this is
not true.
Thanks for help.

Nick


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

Предыдущее
От:
Дата:
Сообщение: Re: Problems with pg_dump
Следующее
От: papapep
Дата:
Сообщение: Re: Problems with pg_dump