Designing Complex Query

  • Dear,

    I have a table Student(Section, Roll, Subjects, Marks). Now I want to display the results like the following. That means the result will show section and Roll wise Subjects, Marks from the Student table. I am using SQL Server 2008 R2.

    Please help me to design the query.

    Section| Roll | Subjects | Marks

    ------- ----- ---------- -------

    X1A 70

    B 60

    C 80

    Y1A 75

    B 85

    C 80

    Z1A 90

    B 78

    C 80

    Regards,

    Akbar

  • shohelr2003 (1/6/2013)


    Dear,

    I have a table Student(Section, Roll, Subjects, Marks). Now I want to display the results like the following. That means the result will show section and Roll wise Subjects, Marks from the Student table.

    Please help me to design the query.

    Section| Roll | Subjects | Marks

    ------- ----- ---------- -------

    X1A 70

    B 60

    C 80

    Y1A 75

    B 85

    C 80

    Z1A 90

    B 78

    C 80

    Regards,

    Akbar

    untested

    SELECT Section.Roll,Subjects,SUM(Marks)

    FROM Student

    GROUP BY Section,Roll,Subjects

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply