Is there any way in mySQL to specify UNIQUE constraint on multiple columns with a constraint of a specific value of a particular column?
Example:
A B
......
1 0
1 1
1 2
2 1
3 0
3 2
in the above table, if B is 0, then it can have the same set of values(row) in the table (duplicate), and if B is 1, then it should not accept the same set of A,B pair. Eg: in this case, it should accept any number of (A,B) = (1,0), (3,0) pairs, since B is 0, but it should not accept duplication of (1,1), (1,2), (2,1), (3,2).