【发布时间】:2013-03-15 03:37:15
【问题描述】:
我正在尝试根据两个表格制作生产报告,这两个表格的日期不同。 (下面的表格示例)
first table (machine ID, production time, date)
-result should be sum of time group by machine ID (parameters - date from - to)
second table (machine ID, repair time, date)
-result should be sum of repair time group by(parameters - date from-to).
在报告中,我需要计算两个表中的总和(例如:from 1.1.2013 to 10.1.2013)。问题是我需要从两个表中使用两个不同的日期参数,但是当我使用该连接时,该连接不能像LEFT OUTER JOIN 那样工作,而是INNER JOIN。(从第一个表我需要所有记录,从第二个只有id=id)
表格示例:
结果必须是:
机器ID |生产时间总和 |维修时间总和(如果有) - 基于从到到
【问题讨论】:
-
请发布您的记录选择公式和您正在使用的表格连接。
-
表连接:
table1 LEFT OUTER JOIN table2 on machineID=machineID选择标准:{spent time} in {?date_from} to {?date_to} and {repair time} in {?date_from} to {?date_to}