I have a table with three columns, the ID of the relation, the ID of the object related and the value of the object. The table may have as many repeated ID-Value relations except when the Value is 0 for the same ID.
Correct Incorrect +--------+--------+-------+ +--------+--------+-------+ | PK_ID | ID | Value | | PK_ID | ID | Value | +--------+--------+-------+ +--------+--------+-------+ | 1 | 1 | 1 | | 1 | 1 | 1 | | 2 | 1 | 1 | | 2 | 1 | 1 | | 3 | 2 | 0 | | 3 | 2 | 0 | +--------+--------+-------+ | 4 | 2 | 0 | +--------+--------+-------+
The question is how can I enforce it not to allow a repeated ID-Value relation when the value is 0?