运行模板报错:错误代码:11300001数据集[图一IOT]配置错误出现不支持的SQL92

image.pngimage.png

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 VALUE

FROM IOT.DAY_MINUTE_RECORD

WHERE 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 VALUE

FROM IOT.DAY_MINUTE_RECORD

WHERE 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

FineReport 帆软用户mVQ2gDxk8Q 发布于 6 天前
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
华莉星宸Lv7资深互助
发布于6 天前

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 VALUE

        

          FROM IOT.DAY_MINUTE_RECORD        

         WHERE 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 VALUE

        

          FROM IOT.DAY_MINUTE_RECORD

        

         WHERE 1 = 1

        

         ${IF(LEN(end1) < 1,

                    "AND TIME_ '"+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

================

image.png

最佳回答
0
用户k6280494Lv6资深互助
发布于6 天前

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 VALUE

FROM IOT.DAY_MINUTE_RECORD

WHERE 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 VALUE

FROM IOT.DAY_MINUTE_RECORD

WHERE 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

  • 3关注人数
  • 69浏览人数
  • 最后回答于:6 天前
    请选择关闭问题的原因
    确定 取消
    返回顶部