Querying First Time In And Last Time Out

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JAS1503
    New Member
    • Feb 2008
    • 1

    Querying First Time In And Last Time Out

    Hi SQL friends,

    We're using a proximity card for logging in the attendance. I have a field for door access and field also for its corresponding log date and time. Since there are several logs of date/time for each day from different doors, can I possibly SELECT only the first time in and last time out for each employee for each day regardless from which door?

    In short, first time in last time out for each day per employee.

    Thank you in advance.

    Cheers!
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    you need to use an agregate query something like this

    Code:
    SELECT left(Dte,11) as Dte,EmployeeID,Min(Dte) as InTime,Max(Dte) as OutTime
    FROM tblYourLogTable
    group by left(Dte,11),EmployeeID
    The left(Dte,11) drops the time from the date. There are other ways of doing that.
    I hope this helps you

    Comment

    Working...