KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I think the following example will explain the situation best. Let's say we have the following table structure: ------------------------------------- Member1 int NOT NULL (FK)(PK) Member2 int NOT NULL (FK)(PK) ------------------------------------- Statust char(1) NOT NULL Here are the table contents for the table: Member1 Member2 Status ---------------------------- 100 105 A My question is how do I implement uniqueness so that the following INSERT statement will FAIL based on that one row already in the table. INSERT status_table (Member1,Member2,Status) VALUES(105,100,'D'); Basically, I'm trying to model a relationship between two members. The Status field is the same whether we have (100,105) or (105,100). I know I could use a before_insert and before_update trigger to check the contents in the table. But I was wondering if there was a better way to do it... Should my database model be different...
Tags (comma-separated)
Save Edits
Cancel