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
Post a Comment