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 7705717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:55:54+00:00 2026-05-31T23:55:54+00:00

I found some good answers for this question, but I can’t really get them

  • 0

I found some good answers for this question, but I can’t really get them to work.

I wan’t to get a players rank from a hiscore table.

id   name   score

1    John    10
2    Linda   5
3    Emmy    25 

I want to pass in a name in the query (Linda) and get her rank (She only have 5 points in the table above), and get her rank (nr 3).

I found a similar question with this answer, but don’t understand it:

SELECT  uo.*, 
    (
    SELECT  COUNT(*)
    FROM    users ui
    WHERE   (ui.points, ui.id) >= (uo.points, uo.id)
    ) AS rank
   FROM    users uo
   WHERE   id = @id

Thanks in advance

  • 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-05-31T23:55:55+00:00Added an answer on May 31, 2026 at 11:55 pm

    Try this query –

    SELECT name, score, rank FROM
      (SELECT *, @r:=@r + 1 rank FROM table_name ORDER BY score DESC) t1,
      (SELECT @r:=0) t2
    WHERE name = 'Linda'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found some other questions about this, but they didn't work for me :(
I found some threads saying this was doable, but did not find specific instructions
I found this question here: OLEDB v/s ODBC Which gave me more information, but
This may be a stupid question but I just can't find the answer. What
I've found some good questions and with good answers for naming threads in Delphi.
Did some searches here & on the 'net and haven't found a good answer
I've searched the Internet and have found some good solutions for teeing STDOUT to
I found some mapkit code on the internet that looks like this: - (void)recenterMap
I found some information about this on Scott Hanselmans Blog Does anybody exactly know
I saw some other similar questions on this topic here but they were not

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.