ihave a simple table that it has some record that There have been several records about students. i want determine rank of each student base on point. i use following query. its ok when i get query for all of student but when i search student by name or family all the student have 1 rank and i know its normal but i have any solution for it. i want to gain real rank when i search a student by name in each class do u know applied solution ?
Select username ,average,[fname],[lname],point, Rank() over(order by point desc) as 'ranking' from karbar where (username=@username) order by point desc
Use subquery.