Re: enforcing with unique indexes.. - Mailing list pgsql-sql

From Rajesh Kumar Mallah.
Subject Re: enforcing with unique indexes..
Date
Msg-id 200210051248.10550.mallah@trade-india.com
Whole thread Raw
In response to enforcing with unique indexes..  ("Rajesh Kumar Mallah." <mallah@trade-india.com>)
List pgsql-sql

Sorry Bhuvan it wont work,

COMPOSITE UNIQUE INDEX will prevent entry of rows like (group_id,user_id)

1 1
1 1

what i want to prevent is this:

1 1
1 2

did you notice the distinct inside the count?
regds
mallah.





On Saturday 05 October 2002 12:36, Bhuvan A wrote:
> > 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?
>
> Yes it can be done using UNIQUE INDEX. Create a composite unique index on
> these 2 fields and it will do the rest. For more details, try
>
> $ \h CREATE INDEX
>
> regards,
> bhuvaneswaran

--
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 by date:

Previous
From: "Rajesh Kumar Mallah."
Date:
Subject: enforcing with unique indexes..
Next
From:
Date:
Subject: Re: enforcing with unique indexes..