如何将一个表与另外两个表相关联,每个表都具有一对多的关系? [英] How to relate one table to two other tables each with a one-to-many relationship?

查看:103
本文介绍了如何将一个表与另外两个表相关联,每个表都具有一对多的关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个叫做植物的桌子。与名为Locations的表有多对多关系的通过名为PlantsToLocations的第三个表格。此设置工作正常。我有一个表格,我可以打开一个位置并输入那里找到的所有植物的清单。


现在,问题是个别植物可能有两个(或更多)科学名称我希望能够在名称字段中搜索任一名称。所以我试图建立植物之间的第二个一对多关系。表和一个名为Species的新表,但无论我如何将Species Table附加到Plants Table,我都无法使它工作。


是否可以附加一个表到另外两个表,每个表都有一对多的关系?

解决方案

每个表都有一个自动编号作为PrimaryKey吗?


< BLOCKQUOTE>是。物种有物种ID作为自动编号和PrimaryKey,植物有一个名为PlantsID,PlantsToLocation有PlantsToLocationID,而地点有LocationsID。


你有可能发布你的人际关系图片吗?听起来不对劲。


I have one table called "Plants" that has a many-to-many relationship with a table called "Locations" through a third table called "PlantsToLocations". This setup works fine. I have a form where I can open a location and enter a list of all the plants found there.

Now, the problem is that individual plants may have two (or more) scientific names and I want to be able to search a name field for either name. So I tried to set up a second one-to-many relationship between the "Plants" table and a new table called "Species", but no matter how I attach the Species Table to the Plants Table, I cannot get it to work.

Is it possible attach one table to two other tables each with a one-to-many relationship?

解决方案

Does every table have an AutoNumber as a PrimaryKey?


Yes. Species has speciesID as an AutoNumber and PrimaryKey, Plants has one called PlantsID, PlantsToLocation has PlantsToLocationID, and Locations has LocationsID.


Any chance you can post a picture of your relationships? Something does not sound right.


这篇关于如何将一个表与另外两个表相关联,每个表都具有一对多的关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆