shah Momin

shah Momin

  • NA
  • 176
  • 21.4k

Getting count of Total Present And Absent In Day Wise sql query

Sep 1 2022 12:35 PM

 

SELECT 
    Day = DATENAME(DW,dutydatetime) -- Wrong function previously used this will get the name
    , Date = CONVERT(VARCHAR, dutydatetime,103) -- this returns in format dd/mm/yyyy other codes are available
    ,COUNT(CASE WHEN [type]='Absent' then 1 end ) as  [Absent]
	,COUNT (CASE WHEN [type]='Present' then 1 end ) as  [Present]  
FROM
    tblattendancelog
GROUP BY 
    DATENAME(DW,dutydatetime)
    ,CONVERT(VARCHAR, dutydatetime,103)
	 ORDER BY 1,2

i Will Try Daily Base Report For " Get Daily of Day Wise Report

Get Month of Day Wise Report

Get Year Of Day Wise Report


Answers (3)