enforcing with unique indexes..

Поиск
Список
Период
Сортировка
От Rajesh Kumar Mallah.
Тема enforcing with unique indexes..
Дата
Msg-id 200210051219.07553.mallah@trade-india.com
обсуждение исходный текст
Ответы Re: enforcing with unique indexes..  (<dev@archonet.com>)
Список pgsql-sql
Hi ,

can anyone tell me how can i enforce below in a table.
I want that no more that one distinct userid exists for a given group_id
in the table.

ie i want 1 to 1 mapping between group_id and userid so that , there shud not be a
single group_id having more that one kind of userid.

SELECT  group_id  from eyp_listing group by group_id  having  count(distinct userid) > 1  ;

always returns empty.

can it be done with some sort of UNIQUE INDEX?


Regds
MAllah.





--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.




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

Предыдущее
От: bens_nospam@benjamindsmith.com
Дата:
Сообщение: Self Join?
Следующее
От: "Rajesh Kumar Mallah."
Дата:
Сообщение: Re: enforcing with unique indexes..