Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Calculate attendance based on another table

$
0
0
I have table called logininfo where each employee gets on record if he is present on that day..i need ur help to calculate total working days of the month[code="sql"]CREATE TABLE logininfo(Emp_code INT,Login_time datetime,Logout_time datetime)INSERT INTO logininfo VALUES(469,'2014-02-01 09:00:00','2014-02-01 17:50:00')INSERT INTO logininfo VALUES(469,'2014-02-02 09:00:00','2014-02-02 17:50:00')INSERT INTO logininfo VALUES(469,'2014-02-03 09:00:00','2014-02-03 17:50:00')INSERT INTO logininfo VALUES(469,'2014-02-04 09:00:00','2014-02-04 17:50:00')INSERT INTO logininfo VALUES(469,'2014-02-06 09:00:00','2014-02-06 17:50:00')[/code]Suppose we have to find the workingdays of the employee from 2014-02-01 to 2014-02-06 output is 5 since there is no record on 2014-02-05 so he is consider has a holiday

Viewing all articles
Browse latest Browse all 3145

Trending Articles