MS ACCESS如何平均2个表中的3列
我有以下表格:
T1:
Repair_ID, Descreption,Cost,Level
(1,a,24,9)
(2,b,34,9)
(3,a,22,3)
(4,c,11,6)
T2:
Repair_ID, Start_Time, End_Time,Location_ID
(1,02:00:00,03:00:00,3)
(2,04:00:00,05:00:00,7)
(3,06:00:00,08:00:00,3)
我希望能够获得一个表格,其中包含平均成本、平均水平和平均维修持续时间(通过从开始时间减去结束时间)按描述和位置 ID 分组 所以表格看起来像这样: 描述、Location_ID、平均成本、平均级别、平均持续时间 (a,3,(24+22/2)=24,(9+3/2=6), 01:30:00*)
- Repair_ID 1 为 1 小时,repair_ID 3 为 2 小时 = 01:30:00平均值,因为这两次修复发生在同一位置并且具有相同的描述 谢谢
I have the following tables:
T1:
Repair_ID, Descreption,Cost,Level
(1,a,24,9)
(2,b,34,9)
(3,a,22,3)
(4,c,11,6)
T2:
Repair_ID, Start_Time, End_Time,Location_ID
(1,02:00:00,03:00:00,3)
(2,04:00:00,05:00:00,7)
(3,06:00:00,08:00:00,3)
I want to be able to get a table that contains an average of the cost, an average of the level, and an average of the duration of the repair(by subtracting end_Time from start_time) grouping by Descreption and Location_ID
so the table would look like this:
Descreption, Location_ID, AvgCost,AvgLevel, Avg Duration
(a,3,(24+22/2)=24,(9+3/2=6), 01:30:00*)
- 1 hour for repair_ID 1 and 2 hours for repair_ID 3 = 01:30:00 on average since these two repairs happened in the same location and have the same descreption
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上非常简单。连接三个表并执行您所描述的计算和分组
更新 设置日期差异平均值的格式有点棘手。您需要在执行聚合后进行格式化。最简单的方法是使用内联视图
This actually pretty straight forward. Join the three tables and do the calculations and grouping you've described
Update Formatting an average of Difference of dates is a little tricky. You need to do the format after the Aggregate has been performed. The easiest way to do this is to use an in line view