问题描述
我正在使用MS Access 2007.如果我发布一个愚蠢的问题,请原谅我,因为我在Access和VBA中仍然是新手。
我有3个名为CRS的表,文档和DocumentInCRS.CRS表中的CRS记录可能属于CRS Open或CRS响应。在CRS表中有一个名为RESPONSE_TO_CRSID的字段,如果它是CRS响应,则它必须具有Response_TO_CRSID - 这些ID可能属于CRS公开或CRS回应。
假设:
CRS01 = CRS公开
CRS03 = CRS响应 - > RESPONSE_TO_CRSID:CRS01
CRS06 = CRS响应 - > RESPONSE_TO_CRSID:CRS03(但CRS03对CRS01的响应)
CRS10 = CRS响应 - > RESPONSE_TO_CRSID:CRS06(但CRS06对CRS03的响应,CRS03对CRS01的响应)
我不知道很多次关系会达到,但不会超过10。
CRS和Document之间的关系是多对多的.DocumentInCRS表充当桥表,将CRS表和Document表连接在一起。
对于那些CRS响应,我不会再将它们以前的文档记录存储在DocumentInCRS中,因为它是通过Response_TO_CRSID链接到它们对CRS的响应,因此它们将包含它们对CRS文档记录的响应。但是,如果有新文档添加到CRS响应,记录将添加到DocumentInCRS中。
使用SQL语句,我希望CRS10的结果包含CRS06,CRS03,CRS01及其自身的所有文档记录。 br />
CRS06和CRS03的情况相同,我可以将所有文件记录到CRS01。
有没有正确的方法来做到这一点?希望听到你们这些人是因为我真的被困了:(
非常感谢
Hi,I am using MS Access 2007.Please forgive me if i post a silly question, as i am still new in Access and VBA.
I have 3 tables named CRS, Document and DocumentInCRS.The CRS record in CRS table might belong to a CRS Open Or CRS Response.In the CRS table there is a field named RESPONSE_TO_CRSID,if it is a CRS Response, then it must have the Response_TO_CRSID - these ID might belong to CRS Open or CRS Response.
let say:
CRS01 = CRS Open
CRS03 = CRS Response -> RESPONSE_TO_CRSID: CRS01
CRS06 = CRS Response -> RESPONSE_TO_CRSID: CRS03 (but CRS03 response to CRS01)
CRS10 = CRS Response -> RESPONSE_TO_CRSID: CRS06 (but CRS06 response to CRS03, CRS03 response to CRS01)
I do not know many the times relationship will reach, but would not be more than 10.
The relationships between CRS and Document is many-to-many.DocumentInCRS table acts as bridge table to link CRS table and Document table together.
For those CRS reponse, I wouldn''t store their previous document records in DocumentInCRS again because it is link to their response-to CRS by Response_TO_CRSID and thus they will contain their response-to CRS document records.However,if there are new documents added to CRS Response,the record will be added in DocumentInCRS.
Using the SQL statement,I want the result for CRS10 to contain all the document records in CRS06, CRS03, CRS01 and itself.
Same case for CRS06 and CRS03 where I can get all the documents record until CRS01.
Is there a proper way to do this?Hope to hear from you guys as soon as possible because I am really stucked :(
Many thanks
推荐答案
这篇关于如何查询可扩展的链接记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!