Multiple parent tables?
Date: Wed, 10 Oct 2001 20:24:37 GMT
Message-ID: <3bc4ab7f.748408281_at_news-server.nyc.rr.com>
I'm building an ordering/workflow system which involves, among others, these three entities: Orders, Items, Revisions.
An Order can contain 0..n Items.
An Order can contain 0..n Revisions
Simple enough: a Parent/Child relationship between Orders/Items, the foreign key of Items being the primary key of Orders.
Same for Orders/Revisions.
Here's where it seems complicated:
A revision is actually made up of 3..4 Items. That is, a Revision has
inherent data, specifically its date, and contains 3..4 instances of
data, each identical to an Item, except that the foreign key of the
items would, in this case, refer to the primary key of the Revision
instead of to an order.
It seems redundant to put Items belonging to Orders in a separate table from Items belonging to Revisions (which in turn belong to Orders), but since I'm stuck as far as how to implement a foreign key in Items which can refer *either* to Orders or to Revisions, I'm
suspiscious that I might be modeling the problem poorly in the first place.Any ideas?
Thanks,
Frank Enos
Received on Wed Oct 10 2001 - 22:24:37 CEST