我有两个列的表,我想打的唯一只有columng is_deleted
值为0 email列,所以下面行是有效的,如果[email protected]
与1
进入它将使其中,如果[email protected]
与0
进入它不应该让。如何在MySQL中做这个约束?如何在一个表中使值为0/1的mysql具有唯一性?
email is_deleted
[email protected] 1
[email protected] 1
[email protected] 1
[email protected] 0
我试图做出独特的两列,它允许一个条目,但它在此之后失败。
[email protected] 1
[email protected] 0
我正在使用唯一字段进行软删除。
感谢您的帮助。