Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
Hi guys, I got a problem about how to make this value become descending. Here is my data on table Rank :

Name | Score
Jack | 3
Mia | 2
Jon | 5
Black | 8
Meisye | 10

I have tried my query :
SQL
SELECT Name, rank() OVER (ORDER BY Score ASC) AS RankScore
FROM Rank

But it still can't work. Anyone, please help. Thanks.
Posted

ascending:

SQL
SELECT Name, rank() OVER (ORDER BY Score Asc) AS rankscore
FROM Rank



Descending:

SQL
SELECT Name, rank() OVER (ORDER BY Score DESC ) AS rankscore
FROM Rank
 
Share this answer
 
v2
Try like this..


select score, DENSE_RANK() over(order by score) as rank from Rank1
 
Share this answer
 
Comments
Ananta Pratama 18-Jun-14 12:27pm    
Sorry, but it's still can't work.. Here's the warning from my SQL : #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(order by score) as rank from Rank LIMIT 0, 30' at line 1
Why it can happen?
 
Share this answer
 
i thought you are try to work in mysql look at this link[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900