本文介绍了如何根据某些条件在sql表中创建唯一键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为jobcode的列。这应该是唯一的,但基于branchid。我的意思是如果该表中的branchid不同,它应该允许再次输入相同的作业代码,但它应该阻止相同的branchid。如果我直接应用唯一键,即使branchid不同,也不允许再次输入相同的数字。
请给我一些建议
感谢先进。
Hi,
i have one column called jobcode. this should be unique but based on branchid. i mean if branchid is different in that table it should allow same jobcode to be entered again but it should block for same branchid. if i apply unique key directly it will not allow to enter same number again even if branchid is different.
please suggest me something
thanks in advanced.
推荐答案
这篇关于如何根据某些条件在sql表中创建唯一键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!