title: How do I use ROW_NUMBER()?
body: <p>I want to use the <code>ROW_NUMBER()</code> to get...</p>
  
  <ol>
  <li>To get the <code>max(ROW_NUMBER())</code> --> Or i guess this would also be the count of all rows</li>
  </ol>
  
  <p>I tried doing:</p>
  
  <pre><code>SELECT max(ROW_NUMBER() OVER(ORDER BY UserId)) FROM Users
  </code></pre>
  
  <p>but it didn't seem to work...</p>
  
  <ol start="2">
  <li>To get <code>ROW_NUMBER()</code> using a given piece of information, ie. if I have a name and I want to know what row the name came from.</li>
  </ol>
  
  <p>I assume it would be something similar to what I tried for #1</p>
  
  <pre><code>SELECT ROW_NUMBER() OVER(ORDER BY UserId) From Users WHERE UserName='Joe'
  </code></pre>
  
  <p>but this didn't work either...</p>
  
  <p>Any Ideas?</p>