TSQL, select values from large many-to-many relationship

Posted by eugeneK on Stack Overflow See other posts from Stack Overflow or by eugeneK
Published on 2010-06-16T08:58:26Z Indexed on 2010/06/16 9:02 UTC
Read the original article Hit count: 269

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server