TSQL, select values from large many-to-many relationship
- by eugeneK
I have two tables
Publishers and Campaigns, both have similar many-to-many relationships with Countries,Regions,Languages and Categories.
more info
Publisher2Categories has publisherID and categoryID which are foreign keys to publisherID in Publishers and categoryID in Categories which are identity columns. On other side i have Campaigns2Categories with campaignID and categoryID columns which are foreign keys to campaignID in Campaigns and categoryID in Categories which again are identities.
Same goes for Regions, Languages and Countries relationships
I pass to query certain publisherID and want to get campaignIDs of Campaigns that have at least one equal to Publisher value from regions, countries, language or categories
thanks