Click here to Skip to main content
14,976,254 members
Home / Discussions / Database
   

Database

 
AnswerRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
DevParty9-Jun-21 1:35
MemberDevParty9-Jun-21 1:35 
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
Mohammad Salmani9-Jun-21 3:08
MemberMohammad Salmani9-Jun-21 3:08 
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
DevParty9-Jun-21 3:39
MemberDevParty9-Jun-21 3:39 
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
David Mujica9-Jun-21 4:25
MemberDavid Mujica9-Jun-21 4:25 
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
Mycroft Holmes9-Jun-21 12:36
professionalMycroft Holmes9-Jun-21 12:36 
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
DevParty10-Jun-21 1:25
MemberDevParty10-Jun-21 1:25 
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
Mycroft Holmes10-Jun-21 12:09
professionalMycroft Holmes10-Jun-21 12:09 
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
Mohammad Salmani10-Jun-21 21:53
MemberMohammad Salmani10-Jun-21 21:53 
Hi,

I have implemented as per below query,If Employee is absent on Saturday and Monday the weeklyoff should be counted as Absent. I have passed the process date parameter in place of static date.


SELECT A.EmpCode,A.AttDate As Sundate FROM Attendance_Details A INNER JOIN (SELECT A.Empcode,A.AttDate As SatDate,A.AttStatus As SatStatus
FROM Attendance_Details A INNER JOIN (SELECT EmpCode,AttDate As MonDate,AttStatus As MonStatus FROM Attendance_Details
WHERE AttDate='2021-06-07' AND DATENAME(WEEKDAY, '2021-06-07') = 'Monday' and AttStatus IN ('A','HL'))T ON T.EmpCode=A.EmpCode
WHERE DATENAME(WEEKDAY, DATEADD(day,-2,'2021-06-07')) = 'Saturday' AND AttStatus IN ('A') AND AttDate=DATEADD(day,-2,'2021-06-07'))T1
ON A.EmpCode=T1.EmpCode AND DATENAME(WEEKDAY, DATEADD(day,-1,'2021-06-07')) = 'Sunday' AND AttStatus NOT IN('AL','SL','PL','ML','FL') AND AttDate=DATEADD(day,-1,'2021-06-07')

Please help to improve the above query...


Thanks & Regards
Mohammad Salmani
GeneralRe: Sandwich Query For Employee Attendance using SQL Server 2005 Pin
DevParty11-Jun-21 1:20
MemberDevParty11-Jun-21 1:20 
QuestionLoad JSON file from network location Pin
Member 144746073-Jun-21 7:36
MemberMember 144746073-Jun-21 7:36 
AnswerRe: Load JSON file from network location Pin
Member 144746073-Jun-21 8:42
MemberMember 144746073-Jun-21 8:42 
AnswerRe: Load JSON file from network location Pin
Mycroft Holmes3-Jun-21 12:15
professionalMycroft Holmes3-Jun-21 12:15 
QuestionSQL Server 2010, smalldatetime insert Pin
jkirkerx1-Jun-21 14:52
professionaljkirkerx1-Jun-21 14:52 
AnswerRe: SQL Server 2010, smalldatetime insert Pin
Mycroft Holmes1-Jun-21 21:31
professionalMycroft Holmes1-Jun-21 21:31 
AnswerRe: SQL Server 2010, smalldatetime insert Pin
Victor Nijegorodov1-Jun-21 21:49
MemberVictor Nijegorodov1-Jun-21 21:49 
AnswerRe: SQL Server 2010, smalldatetime insert Pin
jkirkerx2-Jun-21 8:47
professionaljkirkerx2-Jun-21 8:47 
QuestionGet columns name Pin
_Flaviu27-May-21 23:55
Member_Flaviu27-May-21 23:55 
AnswerRe: Get columns name Pin
Victor Nijegorodov28-May-21 0:22
MemberVictor Nijegorodov28-May-21 0:22 
GeneralRe: Get columns name Pin
_Flaviu3-Jun-21 5:57
Member_Flaviu3-Jun-21 5:57 
GeneralRe: Get columns name Pin
Victor Nijegorodov3-Jun-21 20:13
MemberVictor Nijegorodov3-Jun-21 20:13 
GeneralRe: Get columns name Pin
_Flaviu3-Jun-21 20:37
Member_Flaviu3-Jun-21 20:37 
GeneralRe: Get columns name Pin
Victor Nijegorodov3-Jun-21 21:48
MemberVictor Nijegorodov3-Jun-21 21:48 
GeneralRe: Get columns name Pin
_Flaviu3-Jun-21 23:33
Member_Flaviu3-Jun-21 23:33 
GeneralRe: Get columns name Pin
Victor Nijegorodov4-Jun-21 0:55
MemberVictor Nijegorodov4-Jun-21 0:55 
AnswerRe: Get columns name Pin
Gerry Schmitz4-Jun-21 7:02
mveGerry Schmitz4-Jun-21 7:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.