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 06, 2013 4:27 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, May 21, 2013 5:32 AM
Points: 124, Visits: 324
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 06, 2013 4:40 AM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Yesterday @ 2:39 PM
Points: 1,456, Visits: 14,268
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 !
__________________________________________________________________
Post #1403324
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse