Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:47:09+00:00 2026-06-06T13:47:09+00:00

I have a table: **user** id, name, points Can you suggest me how to

  • 0

I have a table:

**user**
id, name, points

Can you suggest me how to compose a query to get user place by points.

For example:

1, 'David', 5
2, 'Dmitry', 10
3, 'Monica', 15
4, 'Jeniffer', 7
5, 'Andy', 12

User ‘Monica’ has a 1st place based on points, ‘Jeniffer’ – 4th place and so on.

Thanks for advice!

EDIT

I want a query like:

SELECT rank FROM user ... WHERE id = 3;
rank |
1

SELECT rank FROM user ... WHERE id = 5;
rank |
2
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:47:11+00:00Added an answer on June 6, 2026 at 1:47 pm

    Please try the below:

    SELECT
       id,rank, name,point 
    FROM (
        SELECT id,
            name,
            point,  
            @rank := @rank + 1 as rank        
        FROM (
          SELECT * from tblA ORDER by point desc) As a, 
        (SELECT @rank := 0) AS vars      
    
    ) T 
    WHERE id=1
    

    http://sqlfiddle.com/#!2/581fc/9

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table Users which contains columns: id, name, points, extra_points. How can I
I have a table User which has the fields (id, first_name, middle_name, last_name). I
I have a user table 'users' that has fields like: id first_name last_name ...
I have Two tables. 1.Users table (Username , Name) 2.Picture table( ID , Username
I have a zip table and a city table. Thereby a zip code can
I have an existing HTML table, part of a form where the user enters
I already have a User table in my primary application database with an email
I have a table with one field that can point to a foreign key
Here is a concrete example: Wordpress stores user information(meta) in a table called wp_usermeta
I have 3 tables users(id,name),groups(id,name) and users_groups(user_id,group_id). users and groups have many to many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.