Let's say I have a table with the following columns:
P_ID
identifier
Points
Say these columns have over 5,000 records. So we have users with glasses. Each user has a unique line for his point record. Imagine that each user can earn points on a website by clicking somewhere. When they click, I update the database with the points they receive.
So, we have a table with over 5,000 records of people who have points, right? Now I would like to order them by their points (in descending order), so the user with the largest point will be at the top of the page if I run a MySQL query.
I could do this simply by running a query like this:
SELECT `p_id` FROM `point_table` ORDER BY `points` DESC
This query will give me all records in descending order by points.
Ok, here my problem comes , now (when it is ordered ). I would like to display each user they are on. Therefore, I would like to give each user something like this: "You are 623 out of 5374 users." The problem is that I can not specify the number "623".
I would like to run a query that sort the table by points , should โsearchโ or count the line number, where their records are and how to return this value to me.
Can someone help me how to build a query for this? That would be a great help. Thanks.
user1406071
source share