You are describing a design called Polymorphic Associations. This often leads people to trouble.
What I usually recommend:
A --> D <-- B ^ | C
In this design, you create a common parent table D containing a link A and B This is similar to the general supertype in OO design. Now your child table C can refer to the super-table and from there you can get to the corresponding subtable.
Using constraints and compound keys, you can make sure that for a given line in D you can only refer to A or B , but not both.
Bill Karwin Jan 20 '10 at 1:31
source share