From: Rajesh Kumar Mallah. <mallah@trade-india.com>
To: Bhuvan A <bhuvansql@myrealbox.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: enforcing with unique indexes..
Date: Sat, 5 Oct 2002 12:48:10 +0530
Message-ID: <200210051248.10550.mallah@trade-india.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0210051232580.2377-100000@Bhuvan.bksys.co.in>
References: <Pine.LNX.4.44.0210051232580.2377-100000@Bhuvan.bksys.co.in>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mallah@trade-india.com, bhuvansql@myrealbox.com
Subject: Re: enforcing with unique indexes..
In-Reply-To: <200210051248.10550.mallah@trade-india.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox