Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 11F13476020 for ; Sat, 5 Oct 2002 02:45:51 -0400 (EDT) Received: from mail-relay.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 01416476051 for ; Sat, 5 Oct 2002 02:45:44 -0400 (EDT) Received: (qmail 15083 invoked from network); 5 Oct 2002 06:35:41 -0000 Received: from system67.trade-india-local.com (192.168.0.67) by infocom-236-129-del.trade-india.com with SMTP; 5 Oct 2002 06:35:41 -0000 Content-Type: text/plain; charset="us-ascii" From: "Rajesh Kumar Mallah." Organization: Infocom Network Limited. To: pgsql-sql@postgresql.org Subject: enforcing with unique indexes.. Date: Sat, 5 Oct 2002 12:19:25 +0530 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210051219.07553.mallah@trade-india.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/70 X-Sequence-Number: 9788 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 n= ot be a=20 single group_id having more that one kind of userid. SELECT group_id from eyp_listing group by group_id having count(distinc= t userid) > 1 ; always returns empty. can it be done with some sort of UNIQUE INDEX? Regds MAllah. --=20 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.