sameer gadade

sameer gadade

  • NA
  • 61
  • 55.4k

sql query

Jun 30 2012 5:24 AM
hi
i have an table
attendance-(stud id,attenid,classid,present_absent,curr_date,atten_del,teacher_id,replaceteacherid)
replaceteacher is teacher from other class.
and i want query to fetch records like

 

Student name – Sameer

From date - 1jan 2012 to date 31may 2012

 

date                                    attendance

January                                    3/8

February                                  5/8

March                                       8/9

April                                          8/8

May                                           8/9


my query is:
Select st.Last_Name + ' ' + st.First_Name AS 'Name', DATENAME(MM, at.Cur_Date) AS 'Month',
COUNT(at.Present_Absent) as 'Present',
COUNT(at.Cur_Date) as 'Total'
FROM Attendance at, Student st
Where at.Present_Absent = 1
AND st.Student_ID = at.Student_ID
AND st.Stu_Del = 0
AND Attend_Del = 0
AND at.Cur_Date
BETWEEN '6/1/2012'
AND '8/5/2012'
GROUP BY St.Last_Name, at.Present_Absent, at.Cur_Date,St.First_Name

OUTPUT:-my output
 month              present                                           totallecture 

   june    1 (total present lecture)             1(here i want count of tot lectures)

   june    1                                                         1
can any one help me out where do i get wrong

if possible please send the query



Answers (1)