title: inner joins producing erroneous results for no clear reason
body: <p>I am getting <strong>strange</strong> results from inner joins.  Here is the SQL:</p>
  
  <pre><code>SELECT  cm.PersonID
  FROM dbo.vwCommitteeMembers cm
  
  -- first join
  INNER JOIN dbo.vwCommitteeTerms ct 
        ON (ct.CommitteeID = cm.CommitteeID)
  
  -- second join
  INNER JOIN dbo.vwCommitteeTermMembers ctm 
        ON (ct.ID = ctm.CommitteeTermID)
  
  WHERE cm.CommitteeID = 124
  </code></pre>
  
  <p>If I comment out both joins, I get 24 results.  If I uncomment out the first join (leaving second commented out), I also get 24 results.  If, however, both joins are uncommented, the results are inflating to 576.  Since <strong>24^2 = 576</strong>, I have some idea what is happening, but I don't know why.  I am using SQL Server Management Studio 2008, on a Windows 7 Pro x64 workstation, for a SQL Server 2008 database.  It "feels" like SSMS is trying to optimize my query somehow, but I really want to know what the root cause is so I don't have this problem in the future (as this is not the first time I've encountered it).  I even had a colleague take a look since I assumed I was just "too close" to the problem, and they thought it looked okay, too. </p>
  
  <p>Thanks!</p>