Skip to main content
Participant
September 8, 2007
Question

Punch Clock

  • September 8, 2007
  • 2 replies
  • 490 views
Hi all

we have a punch clock with bar code scanner
all the info is saved in a database
in my administration page i want to be able to see who`s in the building right now
so the punch in and out are in the same table

so when i make my cfoutput how can i make it so if theres a duplicate employee number i dont want it to appear on the page but continue the ouput to the nexxt employee

hope it`s clear enough

Thanks1
    This topic has been closed for replies.

    2 replies

    Inspiring
    September 9, 2007
    If your db was oracle, this will work. The same concept will work with other dbs, but the syntax will be different.

    select x.employee_number, otherfields
    from punchclocktable join
    (select employee_number, count(employee_number) punches
    from punchclocktable
    where to_char (time_scan, 'yyyy-mm-dd') = to_char(sysdate, 'yyyy-mm-dd')
    group by employee_id ) x on x.employee_id = punchclocktable.the punchclocktable
    where punches = 1
    September 9, 2007
    It sounds like your database has one table that has two fields: a time for punch in and a time for punch out. While probably not the best database design, you can do the following: when someone punches in, add a new record that has the person's name, the punch in time and an empty punch out time.

    To find out who is punched in, do a SELECT * FROM mytable WHERE punchIn IS not "" and puhchOut IS ""
    timhockeyAuthor
    Participant
    September 9, 2007
    thanks for the reply,

    i have 3 fields in that table
    - record
    - employee_number
    - time_scan

    so it create a record by puching in and another record by punching out