title: Foreign Key to check two columns
body: <p>I have a foreign key between two columns of the two of my tables. Problem is, I also have a "Deleted" column and I consider the record as deleted if it's set to true from my UI. So my foreign key must check that column is set to true or false as well. </p>
  
  <p>Is there any way to do this? I need to create rule like: "Don't allow the second table's Deleted column to set to false, if there are any related records on the first table."</p>
  
  <p>Here is a long explanation if the above is little too complicated:</p>
  
  <pre><code>**Customer**      **StatusType**
  Id               Id
  Name             StatusName
  Surname          Deleted
  StatusId
  Deleted
  </code></pre>
  
  <p>As you can see, I have two tables, and the "StatusId" of the Customer table contains the primary Keys from the StatusType. So I assigned a foreign key to hold them together. </p>
  
  <p>From my interface, I never delete any data from the database, I just set "Deleted" column to "true". And I show only the data which set as "false" on the deleted column anyway.</p>
  
  <p>So here is the question: My foreign key must not allow the "deleted" column of the StatusType table to set as "false", if there are related Customer.StatusId-StatusType.Id records on Customer table.</p>