mysql - Show rank with SQL -


i want "rank" of specific name in database. if type in julia, want #2. (her rank/place in database)

name points

julia       1987 marc        1479  sophia      2517  

select rank (     select name, @rank := @rank + 1 rank     your_table     cross join (select @rank := 0) r     order points desc ) tmp name = 'julia' 

the inner select orders data , adds rank column. outer select gets rank of specific person.


Comments

Popular posts from this blog

angular - DownloadURL return null in below code -

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -