title: Get records having the same value in 2 columns but a different value in a 3rd column
body: <p>I am having trouble writing a query that will return all records where 2 columns have the same value but a different value in a 3rd column. I am looking for the records where the Item_Type and Location_ID are the same, but the Sub_Location_ID is different. </p>
  
  <p>The table looks like this:</p>
  
  <pre><code>+---------+-----------+-------------+-----------------+
  | Item_ID | Item_Type | Location_ID | Sub_Location_ID |
  +---------+-----------+-------------+-----------------+
  |       1 |     00001 |          20 |              78 |
  |       2 |     00001 |         110 |             124 |
  |       3 |     00001 |         110 |             124 |
  |       4 |     00002 |           3 |              18 |
  |       5 |     00002 |           3 |              25 |
  +---------+-----------+-------------+-----------------+
  </code></pre>
  
  <p>The result I am trying to get would look like this:</p>
  
  <pre><code>+---------+-----------+-------------+-----------------+
  | Item_ID | Item_Type | Location_ID | Sub_Location_ID |
  +---------+-----------+-------------+-----------------+
  |       4 |     00002 |           3 |              18 |
  |       5 |     00002 |           3 |              25 |
  +---------+-----------+-------------+-----------------+
  </code></pre>
  
  <p>I have been trying to use the following query:</p>
  
  <pre><code>SELECT *
  FROM Table1
  WHERE Item_Type IN (
       SELECT Item_Type
       FROM Table1
       GROUP BY Item_Type
       HAVING COUNT (DISTINCT Sub_Location_ID) &gt; 1
  )
  </code></pre>
  
  <p>But it returns all records with the same Item_Type and a different Sub_Location_ID, not all records with the same Item_Type AND Location_ID but a different Sub_Location_ID.</p>