SELECT * FROM (SELECT TO_CHAR(TO_DATE(TIME_,'YYYY-MM-DD HH24:MI:SS' ),'MM-DD HH24')AS WORK_TIME,'通道1'AS CLASS ,ROUND((AVG(CH1_NMHCG)+AVG(CH1_NMHCP))/2,2) AS VALUEFROM IOT.DAY_MINUTE_RECORDWHERE 1=1${IF(LEN(end1)<1,"AND TIME_ LIKE'${end}%'","TO_DATE(TIME_,'YYYY-MM-DD HH24:MI:SS')BETWEEN TO_DATE('"+start1+" 00:00:00','YYYY-MM-DD HH24:MI:SS')AND TO_DATE('"+end1+" 23:59:59','YYYY-MM-DD HH24:MI:SS')")}GROUP BY TO_CHAR(TO_DATE(TIME_,'YYYY-MM-DD HH24:MI:SS' ),'MM-DD HH24')UNION ALL SELECT TO_CHAR(TO_DATE(TIME_,'YYYY-MM-DD HH24:MI:SS' ),'MM-DD HH24')AS WORK_TIME,'通道2'AS CLASS ,ROUND((AVG(CH2_NMHCG)+AVG(CH2_NMHCP))/2,2) AS VALUEFROM IOT.DAY_MINUTE_RECORDWHERE 1=1${IF(LEN(end1)<1,"AND TIME_ LIKE'${end}%'","TO_DATE(TIME_,'YYYY-MM-DD HH24:MI:SS')BETWEEN TO_DATE('"+start1+" 00:00:00','YYYY-MM-DD HH24:MI:SS')AND TO_DATE('"+end1+" 23:59:59','YYYY-MM-DD HH24:MI:SS')")}GROUP BY TO_CHAR(TO_DATE(TIME_,'YYYY-MM-DD HH24:MI:SS' ),'MM-DD HH24'))ORDER BY WORK_TIME