Rank SQL query Result
At first declare a variable like below:
set @counter=0;
Then run query like below:
select @counter:=@counter+1 as Rank,LastName,Roll_no as Roll from Students order by Roll_no ASC;
My example table name is Students,ranking based on roll no.
Written by Mushfiq
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#