我有以下查询,我需要每天总结FTBR_QTY_FAILED,但也输出其他列。我尝试了一些分组选项,但我无法输出每天的总和failed_qty和其他列值。 任何人都可以给我任何方向/想法:
<cfquery datasource="UKCHAPP145" name="Q4">
SELECT
TBL_RESULTS.FTBR_QTY_FAILED AS TotalFailedQty,
TBL_RESULTS.FTBR_TASK_UUID,
TBL_RESULTS.FTBR_DATE,
TBL_TASK.TASK_NAME,
TBL_RESULTS.FTBR_UUID
FROM
UKCHAPP145.TBL_RESULTS,
UKCHAPP145.TBL_TASK
WHERE
TBL_TASK.TASK_UUID = TBL_RESULTS.FTBR_TASK_UUID
AND
TBL_RESULTS.FTBR_TASK_UUID = '#URL.TASK_UUID#'
AND
to_char(TBL_RESULTS.FTBR_DATE, 'YYYY') = '#URL.YEAR#'
AND
TBL_RESULTS.FTBR_WEEK_NO = '#URL.WEEK_NUMBER#'
AND
TBL_RESULTS.FTBR_SHIFT IN (#ListQualify(URL.SHIFT,"'",",","ALL")#)
ORDER BY
TBL_RESULTS.FTBR_DATE
ASC
</cfquery>
以下是此查询输出的一些示例数据:
FTBR_DATE FTBR_TASK_UUID FTBR_UUID TASK_NAME TOTALFAILEDQTY
--------------------- -------------- --------- ------------------------- --------------
2015-03-09 00:00:00.0 19971 594052 LOW OR NO FLOW - 1BAR TEST 3
2015-03-10 00:00:00.0 19971 594916 LOW OR NO FLOW - 1BAR TEST 4
2015-03-11 00:00:00.0 19971 595828 LOW OR NO FLOW - 1BAR TEST 12
2015-03-11 00:00:00.0 19971 595843 LOW OR NO FLOW - 1BAR TEST 1
2015-03-12 00:00:00.0 19971 597209 LOW OR NO FLOW - 1BAR TEST 3
2015-03-12 00:00:00.0 19971 597195 LOW OR NO FLOW - 1BAR TEST 13
2015-03-13 00:00:00.0 19971 597859 LOW OR NO FLOW - 1BAR TEST 13
非常感谢
JC