MySql 使用 sql 检索输入和输出时间戳
我有一个如下表:
employee_id location datetime_stamp
21062 28.0 2011-07-12 05:00:00
21062 600.00 2011-07-12 05:05:00 *
21063 600.00 2011-07-12 05:39:48
21063 600.00 2011-07-12 05:40:06
21063 600.00 2011-07-12 05:40:28 *
21063 28.00 2011-07-12 05:41:23
21063 28.00 2011-07-12 05:42:52
21063 28.00 2011-07-12 13:14:24
21063 28.00 2011-07-12 13:15:04
21063 600.00 2011-07-12 13:15:23 *
21063 600.00 2011-07-12 13:15:42
21064 600.00 2011-07-12 21:00:40 *
21064 28.00 2011-07-12 21:01:00
我希望能够在给定单个日期搜索参数的情况下从系统中检索由 * 字符表示的员工日期作为进出戳记。
注意:我遇到的一个问题是某些员工的轮班重叠天数。
期望的输出:
employee# In Out
21062 ??????????????????? 2011-07-12 05:05:00
21063 2011-07-12 05:40:28 2011-07-12 13:15:23
21064 2011-07-12 21:00:00 ???????????????????
我希望这是一个足够清晰的解释。
感谢您对这个问题的任何见解!
I have a table as follows:
employee_id location datetime_stamp
21062 28.0 2011-07-12 05:00:00
21062 600.00 2011-07-12 05:05:00 *
21063 600.00 2011-07-12 05:39:48
21063 600.00 2011-07-12 05:40:06
21063 600.00 2011-07-12 05:40:28 *
21063 28.00 2011-07-12 05:41:23
21063 28.00 2011-07-12 05:42:52
21063 28.00 2011-07-12 13:14:24
21063 28.00 2011-07-12 13:15:04
21063 600.00 2011-07-12 13:15:23 *
21063 600.00 2011-07-12 13:15:42
21064 600.00 2011-07-12 21:00:40 *
21064 28.00 2011-07-12 21:01:00
I want to be able to retrieve the dates indicated by the * characters for an employee as an In and Out stamp from the system given a single date search parameter.
Note: One problem I've run into is some employee's shift overlap days.
Desired output:
employee# In Out
21062 ??????????????????? 2011-07-12 05:05:00
21063 2011-07-12 05:40:28 2011-07-12 13:15:23
21064 2011-07-12 21:00:00 ???????????????????
I hope this is a clear enough explanation.
Thanks for any insight you will be able to shed on this problem!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于我无法提出满足我的特定要求的查询,因此我提取了与上面格式相同的数据,并将输出加载到 C# 中的 ArrayList 中。然后,我遍历数组,查看每个员工当前和之前的位置,以获得进出时间。
Since I was unable to come up with a query for my specific requirements, I pulled the same data as in the format from above and loaded the output into an ArrayList in C#. Then I stepped through the array looking at the current and previous location of each employee to get an In and Out time.