title: many to many select query
body: <p>I'm trying to write code to pull a list of product items from a SQL Server database an display the results on a webpage. </p>
  
  <p>A requirement of the project is that a list of categories is displayed at the right hand side of the page as a list of checkboxes (all categories selected by default) and a user can uncheck categories and re-query the database to view products's in only the categories they want.</p>
  
  <p>Heres where it starts to get a bit hairy.</p>
  
  <p>Each product can be assinged to multiple categories using a product categories table as below...</p>
  
  <pre>
  Product table
  [product_id](PK),[product_name],[product_price],[isEnabled],etc...
  
  Category table
  [CategoryID](PK),[CategoryName]
  
  ProductCagetory table
  
  [id](PK),[CategoryID](FK),[ProductID](FK)
  
  </pre>
  
  <p>I need to select a list of products that match a set of category ID's passed to my stored procedure where the products have multiple assigned categories.</p>
  
  <p>The categort id's are passed to the proc as a comma delimited varchar i.e. ( 3,5,8,12 )</p>
  
  <p>The SQL breaks this varchar value into a resultset in a temp table for processing.</p>
  
  <p>How would I go aout writing this query?</p>