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