MySql 使用 sql 检索输入和输出时间戳

发布于 2024-11-23 16:42:40 字数 1032 浏览 0 评论 0原文

我有一个如下表:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耀眼的星火 2024-11-30 16:42:40

由于我无法提出满足我的特定要求的查询,因此我提取了与上面格式相同的数据,并将输出加载到 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文