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'
>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);