You must Sign In to post a response.
  • Category: ASP.NET

    Query problem

    i hv a table in which i hv total marks & % of stodents subject wise...
    i want to give ranks to each
    student with heighset total get 1 nd so on
    nd if two stu hv same total mks they gat same rank like 3
    nd student below these two student get rank 5 inspite of 4

    how to write query or any solution for this
  • #344766
    You need to use "RANK() OVER" to get the desired output

    SELECT Student_Name, TotalMarks,
    RANK() OVER (ORDER BY TotalMarks DESC) AS TheBest
    FROM Student

    Check out the below link

    Thanks -- Vijaya Kadiyala
    Microsoft MVP

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.