title: sql query distinct with Row_Number
body: <p>I am fighting with the distinct keyword in <code>sql</code>.
  I just want to display all row numbers of unique (<code>distinct</code>) values in a column &amp; so I tried:</p>
  <pre><code>SELECT DISTINCT id, ROW_NUMBER() OVER (ORDER BY id) AS RowNum
  FROM table
  WHERE fid = 64
  </code></pre>
  <p>however the below code giving me the <code>distinct</code> values:</p>
  <pre><code>SELECT distinct id FROM table WHERE fid = 64
  </code></pre>
  <p>but when tried it with <code>Row_Number</code>.<br />
  then it is not working.</p>