title: SQL Server : inner self join returning too many values
body: <p>I have a table (A) of queries that includes the columns question (string) and engine (string). Some of the queries are the same, but the engines are different. I'm trying to do an inner join so that I get a table with the normalized query and the two engines in the same row. So I want to avoid rows that have the query and the same engine twice. </p>
  
  <p>When I run the statement below, it executes, but it contains queries that are listed with only one of the engines, not both. Is my logic wrong?</p>
  
  <pre><code>SELECT DISTINCT 
      X.Engine AS XEnging, Y.Engine AS YEngine, 
      X.Question AS Question 
  FROM 
      A X
  INNER JOIN 
      A Y ON X.Question = Y.Question AND X &lt;&gt; Y
  </code></pre>
  
  <p>I'm using SQL Server and running my scripts in Visual Studio 2017. </p>