小员工/轮班时间表 帮助!
早上好,伙计们,
我有下表:
operator(ope_id, ope_name)
ope_shift(ope_id, shift_id, shift_date)
shift(shift_id, shift_start, shift_end)
这是更好的数据视图 http://latinunit.net/emp_shift.txt
这是表的 select 语句的屏幕截图 http://img256.imageshack.us/img256/4013/opeshift.jpg
我使用此代码
SELECT OPE_ID, COUNT(OPE_ID) AS Total_shifts
from operator_shift
group by ope_id;
来查看每个操作员当前的总班次,它可以工作,但是如果还有 500 行以上,它也会将它们全部计数,问题是,任何人都有更好的方法使我的数据库工作,或者我如何才能告诉系统这些行是一整月,我记得我朋友说过一些关于计数然后除以 30 的事情,但我不确定,如果这个月还没有结束怎么办?并且您想显示迄今为止班次最高的员工
Morning Guys,
I have the following tables:
operator(ope_id, ope_name)
ope_shift(ope_id, shift_id, shift_date)
shift(shift_id, shift_start, shift_end)
here is a better view of the data
http://latinunit.net/emp_shift.txt
here is the screenshot of a select statement to the tables
http://img256.imageshack.us/img256/4013/opeshift.jpg
im using this code
SELECT OPE_ID, COUNT(OPE_ID) AS Total_shifts
from operator_shift
group by ope_id;
to view the current total shifts per operator and it works, BUT if there was 500 more rows it would count them all aswell, THE QUESTION is, anyone has a better way of making my database work, or how can i tell the system that those rows are a whole month, i remember i friend said something about count then devide by 30 but im not sure, what if the month isnt finished? and you want to show the emp with highest shifts to date
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加一个 where 子句:
或者
您可能需要修改日期格式以匹配您的特定实现。
you need to add a where clause:
or alternately
You might need to fudge the date format to match your particular implementation.