title: How can this SQL statement throw the following exception?
body: <p>how can this statement:</p>
  
  <pre><code>DELETE FROM passage
  WHERE passageid NOT IN
  (
      SELECT passageid from PreEndedPassages_passages
      UNION SELECT fromPassageid from severalvisit
      UNION SELECT toPassageid from severalvisit
      UNION SELECT registerPassageid from stationobjects WHERE registerpassageid IS NOT NULL
      UNION SELECT beginPassageid from stationobjects WHERE beginPassageid IS NOT NULL
      UNION SELECT endPassageid from stationobjects WHERE endPassageid IS NOT NULL
  )
  </code></pre>
  
  <p>throw this exception?</p>
  
  <pre><code>The DELETE statement conflicted with the FOREIGN KEY constraint "FK_statobj_begpasid". The conflict occurred in database "db.mdf", table "dbo.stationobjects", column 'beginpassageid'.
  </code></pre>
  
  <p>I have no clue, but it happened. beginPassageId is a foreign key on passageid.</p>
  
  <p>EDIT:
  Consider the NOT IN. I want to delete all passages that don't exist in one of its related tables. It usually works, but it happened once.</p>
  
  <p>Thank you.</p>