sql server - SQL command to get highscore position with similar scores -


please guide me write optimize sql command real position(ranking) of users id order similar scores.

i have written below select command can't distinguish names similar scores , if use "and" specify gamer's name shows number 1 row number not want !

fields : id , name , score

select        count(id) num            hscore        (score>= @scorenumber) 

thanks

i think query you're looking for:

select     [rank]     , id     , name     , score (     select         dense_rank() on (order id desc) [rank]         , id         , name         , score     hscore     (score>=@scorenumber) ) resultset name = 'milad' order score desc 

i'm assuming you're using sql server, since you're using standard notation variable, @ before variable name.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -