Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Designing Complex Query Expand / Collapse
Author
Message
Posted Sunday, January 6, 2013 4:27 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Saturday, November 8, 2014 4:17 AM
Points: 206, Visits: 509
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
------- ----- ---------- -------
X 1 A 70
B 60
C 80
Y 1 A 75
B 85
C 80
Z 1 A 90
B 78
C 80


Regards,
Akbar
Post #1403322
Posted Sunday, January 6, 2013 4:40 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 3:20 PM
Points: 1,931, Visits: 19,903
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
------- ----- ---------- -------
X 1 A 70
B 60
C 80
Y 1 A 75
B 85
C 80
Z 1 A 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
Post #1403324
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse