Re: enforcing with unique indexes..

From: "Rajesh Kumar Mallah(dot)" <mallah(at)trade-india(dot)com>
To: Bhuvan A <bhuvansql(at)myrealbox(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: enforcing with unique indexes..
Date: 2002-10-05 07:18:10
Message-ID: 200210051248.10550.mallah@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Browse pgsql-sql by date

  From Date Subject
Next Message dev 2002-10-05 14:13:12 Re: enforcing with unique indexes..
Previous Message Rajesh Kumar Mallah. 2002-10-05 06:49:25 enforcing with unique indexes..