SQL关系
|
我有四个表:
任务-具有batch_id并估算任务完成所需的时间
批处理-任务组
batch_log-显示每个任务的工作时间的条目,并带有一个用户ID(工作人员)。
操作-批次运行的机器类型,油漆,丝网印刷等。
如何使每个用户的每个批次工作,这些批次ID的每个批次日志的总消耗量以及该批次的每个任务ID的总估算值?
编辑:
表格:
task
id estimated_nonrecurring estimated_recurring batch_id
batch
id operation_id date_entered
batch_log
id userid batch_id time_elapsed
operation
id name
我在想:
get each user;
get a list of distinct batch_ids that they worked on;
get a sum of all the time_elapsed from each batch_log for those batch id;
get all the non_recurring and the recurring for each task with each batch_id;
so that the result is like
userid, operation, batch_id, total_elapsed, total_estimate, date_entered
这样做的理由是,可以对用户的生产率进行评分,并在excel中使用这些查询。我想我可能必须要考虑两个问题:
批处理日志
查询以获取每个批次的估计总数
没有找到相关结果
已邀请:
3 个回复
朗排谎纷瘟
没有任何表结构可以说很难。
古擅坛犯
稼悸