title: SQL Server TOP(1) with distinct
body: <p>I am trying to extract the first row I get after ordering the result by <code>i_version_id</code>. If I do not use <code>TOP(2)</code>, my query works as expected ans returns all results sorted by i_version_id. But when I add the <code>TOP(2)</code> (as shown below), it says that there is a syntax error near <code>distinct</code>. Please let me know what I am doing wrong.</p>
  
  <pre><code>SELECT TOP(2) 
      distinct(i_version_id) 
  FROM 
      [PaymentGateway_2006].[dbo].[merchant] 
  WHERE 
      dt_updated_datetime &gt; '2013-11-11'
  GROUP BY
      i_version_id 
  ORDER BY 
      i_version_id;
  </code></pre>