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 gr
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
>
> 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.
>
> can it be done with some sort of UNIQUE INDEX?
If you want multiple groups but the user should always be the same
1 1 ok
1 1 ok
2 1 ok
3 2 ok
Try a rule or a triger that checks for
NOT EXISTS ( select 1 from eyp_listing where group_id = New.group_id and
userid != New.userid)
"Rajesh Kumar Mallah." wrote:
>
> 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