本文介绍了在Sql Server 2008中计算时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 亲爱的朋友, 我在实现查询时遇到了一些问题。我构建了一个存在三列的表,第一个是employeeid,第二个是日期和最后一次。问题如下: - 考虑公司工作时间从9:30到6:30开始。当我进入办公室,因为我的员工是1,今天的日期是2013年6月28日,我的办公时间是上午9:30,然后我有时间在办公室工作,然后在上午11:00出来快速休息,上午11点15分来到办公室。后来我在办公室下午1点吃午饭,下班时间下午1:30上班。这可以按照以下方式办理: - EmpId日期时间 1 28-jun-2013 9:30 am ----> in 11:00 am -----> out 上午11:15 ---->在 01:00 pm -----> out 01:30 pm ----->在 03:00 pm ------> out 03:10 pm ----- >在 05:00 pm ------> out 05:15 pm ------>在 06:30 pm ------> out 问题如下: - 我想计算一下办公室有多少工作时间?有多少时间不在办公室工作? 这只能通过单一查询完成,而不是由任何列实现。 谢谢你提前!! 解决方案 Dear Friend,I have some problem when implementing a query.I construct a table that exists three columns first is employeeid,second is date & last one time.The problem is as follows :-consider The company working office time started 9:30 to 6:30. When i am entered in the office as my employeeid is 1,today date is 28-jun-2013 and my in time office is 9:30am then i am some time work in the office then out at time 11:00am for break fast and come in the office 11:15am.Later i am out in the office 1:00pm for lunch and come in office 1:30pm for work.This can be done as follows:-EmpId Date Time1 28-jun-2013 9:30am---->in 11:00am----->out 11:15am---->in 01:00pm----->out 01:30pm----->in 03:00pm------>out 03:10pm----->in 05:00pm------>out 05:15pm------>in 06:30pm------>outThe problem is as follows :-I want to calculated "How many working time in the office ? and how many time not work in the office ?"This can be done only by single query and not implemented by any columns.Thanks in advanced !! 解决方案 这篇关于在Sql Server 2008中计算时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 09:08
查看更多