arslanovski 0 Newbie Poster

I'm writing a program determine employee's working hours in a day by entry and exit clock in classes. In sql, I have a table, there are 4 field like : classID, cardID, date and clock.
Teacher come to class and every teacher have an unique card. Card reader read this card and record in db. How can I find whether entry clock or exit clock in db. Because teacher forget the card read when the teacher exit in the class. First off all I guess I compare cardId secondly time and classId in a slope.

I use to sql server 2005. It is very urgently.

Sample data is:

CardID ClassID Date Clock
A 1 15.12.2008 08.30 AM
A 1 15.12.2008 10.30 AM
A 1 15.12.2008 11.30 AM
A 2 15.12.2008 13.30 AM
A 2 15.12.2008 15.30 AM