从表格中查找每周摘要
我在这里编写一条 SQL 语句,用于从表中查找每周摘要。我有一个包含以下字段的表:
UIN, Date, Staff, work_hours
现在我想收集员工一周工作多少小时的信息。
I am here to write a SQL statement for finding the weekly summary from a table. I had a table with following fields:
UIN, Date, Staff, work_hours
Now I would like to gather information how many hours has a staff worked in one week.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从您的问题中很难看出,但如果您正在查找每位员工一周内的总工作时间,请尝试以下操作:
否则,如果您正在查找按周汇总的完整报告,您可以尝试以下操作,这将为您提供每个员工每周的工作时间,按周汇总:
It's hard to tell from your question, but if you're looking for the total hours in one week by each employee, try the following:
Otherwise, if you're looking for a full report, summarized by week, you can try the following, which will give you each staff's weekly hours, aggregated by week:
您可能想尝试如下所示:
测试用例 (MySQL):
结果:
You may want to try something like the following:
Test case (MySQL):
Result: