title: Distinct and order by issue in SQL query (Easy but is it possible?)
body: <p>I have a table with these columns (MS SQL-Server 2008);</p>
  
  <p><strong>city cityDate</strong></p>
  
  <p>and rows like this;</p>
  
  <ul>
  <li>Porto | 20.11.1988</li>
  <li>Porto | 19.11.1988</li>
  <li>Lisbon | 21.11.1988</li>
  </ul>
  
  <p>What I want is ordering the date column (desc) and getting the distinct values of city. So the resut should be;</p>
  
  <ul>
  <li><strong>Lisbon</strong></li>
  <li><strong>Porto</strong></li>
  </ul>
  
  <p>I tried;</p>
  
  <pre><code>select distinct(city) from TableCity order by cityDate desc
  </code></pre>
  
  <p>but the output is;</p>
  
  <blockquote>
    <p>Msg 145, Level 15, State 1, Line 1 ORDER BY items must appear in the
    select list if SELECT DISTINCT is specified.</p>
  </blockquote>