每天打卡两次以上 [英] punching card more than twice in a day

查看:75
本文介绍了每天打卡两次以上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要查询,我正在制作人力资源管理软件....
在这种情况下,某个员工上班和打孔卡,晚上又去打孔卡回家,但在此期间,他在打孔卡后休息了一段时间,然后又来了然后打孔卡.

为简单起见,他两次来办公室,两次去办公室,我需要总工作时间


打孔卡的颜色是日期时间
Actual_card_in_ time Actual_card_out_time

I need a query ,I am making Human resource management software ....
in the scenario a employee come in office & punch card & go home at the night & punch card but during the time he went for the break for some time after punch card & come again then punch card.

In simplicity he come office two times & go from office two time ,,I need the total workking times


the coloum for punch card is date time
actual_card_in_ time actual_card_out_time

推荐答案

您可以将两个日期之间的差求和.像这样的东西:
You could sum the difference between the dates. Something like:
SELECT SUM(DATEDIFF(hour, actual_card_in_ time, actual_card_out_time))
FROM YourTable
WHERE ...


您可以将最短的时间作为特定日期的时间.
您可以将最大时间作为特定日期的打卡时间.

例如.冲入-
select min(logintime) from table where logindate = GetDate()

例如.冲出-
select max(logintime) from table where logindate = GetDate()
You can take the minimum time as the punch in time for a particular day.
You can take the maximum time as the punch out time for a particular day.

E.g. Punch in -
select min(logintime) from table where logindate = GetDate()

E.g. Punch out -
select max(logintime) from table where logindate = GetDate()


这篇关于每天打卡两次以上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆