title: Mysql - How to get a row number after Order by?
body: <p>Let's say I have a table with the following columns:</p>
  
  <hr>
  
  <p>p_id</p>
  
  <p>userid</p>
  
  <p>points</p>
  
  <hr>
  
  <p>Let's say these columns have over 5000 records. So we actually have users with points. Each user has an unique row for their point record. Imagine that every user can get points on the website by clicking somewhere. When they click I update the database with the points they get.</p>
  
  <p>So we have a table with over 5000 records of people who have points, right? Now I would like to order them by their points (descending), so the user with the most point will be at the top of the page if I run a MySQL query.</p>
  
  <p>I could do that by simply running a query like this:</p>
  
  <pre><code>SELECT `p_id` FROM `point_table` ORDER BY `points` DESC
  </code></pre>
  
  <p>This query would give me all the records in a descending order by points. </p>
  
  <p>Okay, <strong>here my problem comes</strong>, now (when it is <strong>ordered</strong>) I would like to display each user which place are they actually. So I'd like to give each user something like this: "You are 623 of 5374 users". The problem is that I cannot specify that "623" number.</p>
  
  <p>I would like to run a query which is <strong><em>order the table by points</em></strong> it should "search" or count the row number, where their records are and than return that value to me.</p>
  
  <p>Can anyone help me how to build a query for this? It would be a really big help. Thank you.</p>