Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Count how many times in report

i am looking to count how many time have present or Absent in Lesson1 in this day or current date

i tray this code but i don’t know how can i have it in current day

    SELECT TOP (1000) [Attendance_ID]
      ,[Attendance_Date]
      ,[Lesson_1]
      ,[Lesson_2]
      ,[Lesson_3]
      ,[Lesson_4]
      ,[Lesson_5]
      ,[Lesson_6]
      ,[Remark]
      ,[Student_ID]
      FROM [Attendance_Management_System].[dbo].[Attendance_Table]

  select count(*) FROM Attendance_Table where  Lesson_1='Present' 

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use the GETDATE() function to get the current date.

SELECT COUNT(*) AS CountPresent
FROM Attendance_Table
WHERE Lesson_1 IN ('Present')
  AND Attendance_Date = CAST(GETDATE() AS DATE);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading