OrderID自动编号PK 客户编号FK 订单详细信息 OrderEtc ... 表3; tblOrderEvents OrderEventID自动编号PK OrderID编号FK EventID编号FK OrderEventDate日期/时间 表四; tblEvent EventID自动编号PK EventType 您目前正在尝试在没有链接表的情况下尝试在订单和事件之间创建多对多的关系。测试此语句很简单:订单#1可以有多个EventType ...但是,事件#1可以与多个订单相关联。这告诉我们这两个主题之间存在多对多的关系,因此需要名为tblOrderEvents的链接表。 然后你将检查任何具有等于New_Order的EventID的OrderID小于或等于任何日期,并且没有等于Order_Close的EventID,或者Order_Close大于或等于任何日期。 我必须暂时退出,但稍后会详细介绍如何完成第二步。 问候, Scott I think you have a design issue on the table structure... Essentially you should have four tables with the data that you are giving me: Table one;tblCustomersCustomerID Autonumber PKCustomerFirstCustomerLastCustomerEtc... Table two;tblOrdersOrderID Autonumber PKCustomerID Number FKOrderDetailsOrderEtc... Table three;tblOrderEventsOrderEventID Autonumber PKOrderID Number FKEventID Number FKOrderEventDate Date/Time Table four;tblEventEventID Autonumber PKEventType You are currently suffering from trying to create a many to many relationship between orders and events without the linking table. Testing this statement is easy: Order #1 can have more than one EventType... However, Event #1 can be associated with more than one Order. That tells us a many to many relationship exists between these two subjects, thus requiring the linking table called tblOrderEvents. Then you will to check for any OrderID that has an EventID equal to New_Order that is less than or equal to whatever date, and does not have an EventID equal to Order_Close, OR Order_Close is greater than or equal to whatever date. I have to step out briefly, but will be back in a bit with more detail on how to accomplish the second step. Regards,Scott 这篇关于MS Access Loop?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-14 00:43