MySql 多字段主键问题
我有一个带有主键的表,该表由三列构建。在另一个表中,我想将它们作为一个单列外键引用。如何解决这个问题?也许是 id 别名?或者说如何解决这个问题?
I have a table with a primary key which is built from three columns. In an other table I would like to reference to them as one single column foreign key. How can this be resolved? Maybe an id alias? Or how can this be resolved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有什么好的办法,只能将这三个都用作外键。您可以在原始内容上引入一个额外的唯一值列,并引用它,但这不是一个很好的方法。
There is no good way to do this, just use all three as a foreign key. You could introduce an additional unique-values column on the original, and reference that, but it isn't a great approach.