Currently -- two optional foreign keys to one primary key

P

Paolo

Hello,

I have three tables from a Purchase Order database:

tblComponents
ComponentID (PK)

tblPODetails
LineItemID (PK)
Purchase OrderID (PK)
ComponentID
Material
ComponentIDRef

tblPurchaseOrder
PurchaseOrderID(PK)

Could someone please advise me how to rearrange this to take into
consideration that ComponentID and ComponentIDRef in tblPODetails are
optional fields and foreign keys to ComponentID in tblComponents? I
know I am going about this poorly. Each record in tblPODetails can
either contain a component or a material. If it is a component, the
field ComponentID is filled in (Material and ComponentIDRef are null).
If it is a material, then Material and ComponentIDRef are filled in
(ComponentID is null).

Thanks in advance,

(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top