Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Ehtesham Siddiqui
Starting Member
10 Posts |
Posted - 2011-11-24 : 08:28:37
|
| Hi,I have a Attendance table named say Attendance which has Class and Status along with some other fields.Class will have the name of the class the student is in,whereas the status will have the Absent/Present data.There is another table named say ClassMaster which is the master which will have all the classnames and there is a column of ClassTeacher which will have the EmployeeCode.This employeeCode comes from a table EmployeeMaster.My requirement is i want to get the count of Absent students in Attendance table depending on the Class.For Example if there are two class say ClassA and ClassB,then i should get the count of the Students from Attendance table that belong to Class A and Class B.How cn i do this in one Query.Please guide |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-11-24 : 08:47:53
|
If you want a quick help then please givetable structure, sample data and wanted result. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Ehtesham Siddiqui
Starting Member
10 Posts |
Posted - 2011-11-24 : 09:14:42
|
| Hi,I have three Tables.One is EmployeeMaster(EmpCode,EmpName,MobileNo)Sample Date EmployeeMaster(1,SameerKhan,4512541321)ClassMaster(ClassId,ClassName,EmpCode)Sample Data ClassMaster(1,ClassA,1)Here EmployeeCode in ClassMaster is the EmpCode from EmployeeMaster.Attendance(StudentID,Class,Status)sample data Attendance(445,ClassA,Absent) Here Class will come from ClassMaster Now suppose there are 3 students record in Attendance of them 2 are having status='Absent'.Then i should get the number of students absent and to which class and who is the Class teacher and what his mobile No.Something like this belowNoOfAbsents 2 Class Class A Teacher SameerKhanMobile 4512541321Text in the bold are Column Names and Text in Italic are Expected Data.SMKSoftware EngineerIndia |
 |
|
|
|
|
|
|
|