your design problem is common
the difficulty arises when you want to join a row from Member through the Linking table to... ?
with three separate tables, one strategy for selecting the right table is select stuff from member, linking, marketing
union all
select stuff from member, linking, dreamco
union all
select stuff from member, linking, vendorsthis works fine because only one of the subselects in the UNION will bring back any rows!
however, there's still a problem
the reason for having three different tables is usually because they have wildly different contents -- different number of columns, different types of columns, etc.
this implies that writing the UNION will not be as simple as above, since all three subquery result sets have to have the same number of columns and be datatype compatible (otherwise you get a syntax error in the UNION)
thus when the three tables are wildly different, you can only shoehorn them all together in the UNION by judicious use of CAST() and NULL in the subquery SELECT lists
this also makes the final result set difficult to "untangle"
your only other solution is to get a partial union from Member and Linking and then use IF/ELSE logic in the calling program to decide which third table to get
another way to approach the design problem is to redesign the three different tables into one table
there will probably be more columns, and some of them will make sense only for certain types of row
the "tableType" column that you now have in each of the three tables will still be in this combined table, but it will be a "rowType" column instead
this approach also requires some shoehorning, but i personally think this is the better way to go
it makes the join query simple
and when you think about it, the chances are that the three different tables aren't really wildly different
after all, they already had name, phone, etc. in common, eh?
;o)
rudy
http://rudy.ca/