lundi 25 juillet 2016

Unable to apply a constraint when data in a column for multiple rows need to be kept unique for a particular foreign key's reference

Let me explain this scenario, with my table structure-

RoomId  RoomMemberId
R1       RM1
R1       RM2
R1       RM3    
R2       Rm1
R2       RM2
R3       RM1
R3       RM4
R3       RM3

Here in the above table RM1,RM2 and RM3 are the member of R1 room , now I have to apply a constraint that there should not be any other room where only these three are members i.e. there should not be any other room with same room members.

How can i do it at database end, by any unique constraint or any other way to do so ?? Pls help...

Aucun commentaire:

Enregistrer un commentaire