title: SQL - 'DISTINCT' based on only some columns?
body: <p>I have a database with two tables. One of the tables contains users, the other contains addresses for those users. Each user may have several addresses (though each address is tied to only one user.)</p>
  
  <p>I want to create a search that only returns one entry for each user, even if that user has several addresses. It doesn't matter which address the search pulls back - whatever the search finds first is enough.</p>
  
  <p>Here is an example search result:</p>
  
  <pre><code>tst  olix  Chicago  IL  USA
  tst  olix  Los Angeles  CA  USA
  tst2 olix2 Houston  TX USA
  </code></pre>
  
  <p>I need the search to be such that it only returns 2 rows, rather than 3.</p>
  
  <p>Any ideas?</p>
  
  <pre><code>SELECT DISTINCT
      Users.Firstname, Users.Surname, Users.UserId, 
      Users.Recommendations, Addresses.City, Addresses.Region,
      Addresses.Country
  FROM
      Users INNER JOIN
      Addresses ON FT_TBL.UserId = Addresses.UserId
  ORDER BY
      Users.Recommendations
  </code></pre>