title: How to add rank column?
body: <p>I would like to select records and determine rank number for each similar data.</p>
  
  <p>My data is as follows.</p>
  
  <pre><code>MEMBER ID | LOAN AMOUNT 
  1         | 2,000.00 
  2         | 1,000.00 
  3         | 4,000.00
  4         | 1,000.00 
  </code></pre>
  
  <p>The result I wanted is shown below. </p>
  
  <pre><code>RANK|MEMBER ID|LOAN AMOUNT 
  1   |3        |4,000.00
  2   |1        |2,000.00
  3   |2        |1,000.00
  3   |4        |1,000.00 
  </code></pre>
  
  <p>RANK is a new column. I am using MS SQL server 2008 and created a view table as shown below but it does not resulting to what is wanted.</p>
  
  <pre><code>  select rank=count(*), s1.MemberID, s1.Loan_Amount 
     from (select MemberID, Loan_Amount from vwPrintTop20Borrowers) s1
     group by s1.MemberID, s1.LOAN_AMOUNT
       order by rank, s1.Loan_amount DESC
  </code></pre>
  
  <p>Please help. Thanks! :)</p>