Click here to Skip to main content
15,910,797 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
SQL
select FullName,max(CheckTime),EmployeeAttendance.ActionType from dbo.EmployeeAttendance
 inner join EmployeeDetails on EmployeeDetails.EmployeeID=EmployeeAttendance.EmployeeID

 group by EmployeeAttendance.ActionType,FullName
Posted
Comments
Member 10501509 10-Feb-14 6:09am    
the output getting for me
FullNam (No column name) ActionType
ALEKYA 2014-05-10 00:00:00.000 i
ALEKYA 2014-05-06 00:00:00.000 o
deepthi 2014-01-22 16:25:52.600 I
deepthi 2014-01-22 16:43:33.937 O
Member 10501509 10-Feb-14 6:10am    
the exepeted output should be
FullName (No column name) ActionType
ALEKYA 2014-05-10 00:00:00.000 i
deepthi 2014-01-22 16:43:33.937 O

1 solution

SQL
select  a.AttendanceID,a.CheckTime,a.ActionType,b.FullName  from EmployeeAttendance a join EmployeeDetails b on a.EmployeeID=b.EmployeeID  where   AttendanceID  in (select top 1 AttendanceID from EmployeeAttendance b
where a.EmployeeID=b.EmployeeID order by AttendanceID desc)and a.ActionType='i'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900