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

  • Home
  • SEARCH
  • 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 8830773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:10:11+00:00 2026-06-14T08:10:11+00:00

below query cool for normal users ranking by score but I need a query

  • 0

below query cool for normal users ranking by score but I need a query with same rank result for same scores in table

SET @rank = 0;
SELECT * FROM (
    SELECT @rank:=@rank + 1 AS rank,score, user_id FROM site_crossword_members ORDER BY score DESC 
) as tmp; 

thanks

  • 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-14T08:10:12+00:00Added an answer on June 14, 2026 at 8:10 am

    Are you sure that your given query even works properly? I recall ORDER BY to be done after SELECT, thus making your rank sort by ID ASC or similiar.

    SELECT user_id, 
        CASE WHEN @score != score THEN @rank := @rank + 1 ELSE @rank END AS rank,
        @score := score AS dummy_value
    FROM (  SELECT score, user_id
            FROM site_crossword_members, 
                (SELECT @rank := 0, @score := NULL) AS vars
            ORDER BY score DESC) AS h
    

    Shortened version:

    SELECT user_id, 
        @rank := @rank + (@score != score) AS rank,
        @score := score AS dummy_value
    FROM (  SELECT score, user_id
            FROM site_crossword_members, 
                (SELECT @rank := 0, @score := NULL) AS vars
            ORDER BY score DESC) AS h
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using below query to count the daily result, but now I'm make it
When i execute the below query it throws an error, alter table `ttis`.`users` add
I have below query running on my users and chats table to join and
Right now the below query returns 1 row for each result.... I need to
I am trying to extract the below query: select '<tr><td>'||column1||'</td>', '<td>'||column2||'</td>', '<td>'||column3||'</td></tr>' from table
Please look into the below query declare @t table(roleid int null,EmailAddress varchar(50) null) insert
I tried the below query but it didnt executed giving error as : >
I had the below query working in mysql 4.1, but does not in 5.0:
While trying to execute the below query Declare @t table (id int, string varchar(1000))
i echoed the query below: (query is safe) UPDATE otelozellik SET isim_tr='test', aciklama_tr='<p>test1</p>', uyari_tr='test',

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.