Home Forums SQL Server 2008 T-SQL (SS2K8) Retrives the subject wise highest marks list in a table RE: Retrives the subject wise highest marks list in a table

  • chkri.panati (6/21/2013)


    SELECT StudentName,Class,MAX(Marks) AS MAX_Marks FROM Student123

    GROUP BY StudentName,Class

    ORDER BY Class

    I'm pretty sure that's not going to work with the original data and table structure given in the original post.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)