title: SQL Query Multiple Columns Using Distinct on One Column Only
body: <p>I am trying to write a SQL query that selects multiple columns from a table with the distinct operator on one column only.</p>
  
  <p>The table is simple. The columns are:</p>
  
  <pre><code>tblFruit_ID, tblFruit_FruitType, tblFruit_FruitName
  int          NVarChar            Text
  </code></pre>
  
  <p>I am trying to select all the tblFruit_FruitType with their corresponding tblFruit_ID.</p>
  
  <p>I have tried:</p>
  
  <pre><code>Select Distinct(tblFruit_FruitType), tblFruit_ID FROM tblFruit
  </code></pre>
  
  <p>-Returns all results, not just distinct</p>
  
  <pre><code>Select tblFruit_FruitType, tblFruit_ID FROM tblFruit Group By tblFruit_FruitType
  </code></pre>
  
  <p>-Errors with Column tblFruit_ID is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.</p>
  
  <pre><code>Select tblFruit_FruitType, tblFruit_ID FROM tblFruit Group By tblFruit_FruitType, tblFruit_ID
  </code></pre>
  
  <p>-Returns all results, not just distinct</p>
  
  <p>I also checked out these similar posts and could not get anything to work :(</p>
  
  <p><a href="https://stackoverflow.com/questions/5967130/mysql-select-one-column-distinct-with-corresponding-other-columns">mySQL select one column DISTINCT, with corresponding other columns</a></p>
  
  <p><a href="https://stackoverflow.com/questions/7338884/sql-server-distinct-union-for-one-column">SQL Server Distinct Union for one column</a></p>
  
  <p>Hopefully this is enough information for an answer.</p>
  
  <p>Thank you for your time!</p>
  
  <p>EDIT (Sample Data and Desired Results)</p>
  
  <pre><code>tblFruit_ID, tblFruit_FruitType, tblFruit_FruitName
  int          NVarChar            Text
  1            Citrus              Orange
  2            Citrus              Lime
  3            Citrus              Lemon
  4            Seed                Cherry
  5            Seed                Banana
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>1            Citrus
  4            Seed
  </code></pre>