Select date, name, (Case Attendance Status when 'White shift 'then' ○ 'end) as white shift, (Case Attendance Status when 'Night shift 'then' ○ 'end) as night shift, (Case Attendance Status when 'then' ○ 'end) as rest, (Case Attendance Status when' shift 'then' ○ 'end) as shift, (Case Attendance Status when 'theen' ○ 'end) as sick leave, (Case Attendance Status when' false 'then' ○ 'end) as false, (Case Attendance Status when' late 'then' ○ 'end) as late, (Case Attendance Status when' early return 'then' ○ 'end) as early leave, (Case Attendance Status when 'absenteeism 'then' ○ 'end) as absenteeism, (Case Attendance Status when' other 'then' ○ 'end) as others, departments, ID card numbers, ID from DBO. personnel _ attendance table where (Department = @ Department) and (date = @ date)
'Collect the daily attendance data of a department by Attendance Status
Select date, department,
Count (Case Attendance Status when 'White shift 'then' ○ 'end) as white shift,
Count (Case Attendance Status when 'then' ○ 'end) as night shift,
Count (Case Attendance Status when 'resting 'then' ○ 'end) as resting,
Count (Case Attendance Status when 'retreat 'then' ○ 'end) as retreat,
Count (Case Attendance Status when 'theen' ○ 'end) as sick leave,
Count (Case Attendance Status when 'false 'then' ○ 'end) as false,
Count (Case Attendance Status when 'late' then' ○ 'end) as late,
Count (Case Attendance Status when 'Leave early 'then' ○ 'end) as leave early,
Count (Case Attendance Status when 'absenteeism 'then' ○ 'end) as absenteeism,
Count (Case Attendance Status when 'others' then' ○ 'end) as others
From DBO. Personnel _ attendance table
Where Department = 'device tools'
Group by date, Department
Order by date DESC
'Attendance status of each organization is calculated on a monthly basis.
Select STR (Year (date) + '-' + ltrim (STR (month (date) as date, department, count (Case Attendance Status when 'White shift 'then' ○ 'end) as white shift,
Count (Case Attendance Status when 'then' ○ 'end) as night shift, count (Case Attendance Status when' resting 'then' ○ 'end) as rest,
Count (Case Attendance Status when 'retreat 'then' ○ 'end) as retreat, count (Case Attendance Status when' sick leave 'then' ○ 'end) as sick leave,
Count (Case Attendance Status when 'then' ○ 'end) as leave, count (Case Attendance Status when' late 'then' ○ 'end) as late,
Count (Case Attendance Status when 'leaving early 'then' ○ 'end) as leaving early, count (Case Attendance Status when 'absenteeism 'then' ○ 'end) as absenteeism,
Count (Case Attendance Status when 'others' then' ○ 'end) as others
From DBO. Personnel _ attendance table
Where (Department = @ Department) and (Year (date) = year (@ date ))
Group by STR (Year (date) + '-' + ltrim (STR (month (date), Department
Order by STR (Year (date) + '-' + ltrim (STR (month (date) DESC