title: How to reference other tables in check constraints?
body: <p>I have a table, ProductSupportArticles:</p>
  
  <pre><code>ProductSupportArticleID int NOT NULL &lt;primary key&gt;
  ParentArticleID int NULL
  ProductID int NOT NULL
  Title varchar(100) NOT NULL
  Content varchar(MAX) NOT NULL
  </code></pre>
  
  <p>ProductID is a foreign key to Products.ID, ParentArticleID is a foreign key to the same table, ProductSupportArticles.ProductSupportArticleID. I have a check constraint ProductSupportArticleID != ParentArticleID so that an article cannot be its own parent.</p>
  
  <p>However, a support article pertaining to a particular product should not be able to be the parent or child of an article pertaining to a different product. How can I add a check constraint or similar saying: <code>(ProductID = (SELECT ProductID FROM ProductSupportArticles P WHERE ParentArticleID = P.ProductSupportArticleID))</code></p>
  
  <p>Or how should I implement my tables differently?</p>