帮忙简化以下sql: select * from ( select SUBWORKORDERNO as flowid,WORKLOAD from UIRMS.TEMP_LINE_EXCEL_WORK temp left join ( s

动态 未结 0 127
小小草
小小草 LV1 2023年9月23日 23:20 发表
以下是简化后的SQL语句: SELECT * FROM ( SELECT temp.SUBWORKORDERNO AS flowid, temp.WORKLOAD FROM UIRMS.TEMP_LINE_EXCEL_WORK temp LEFT JOIN ( SELECT subWorkOrderNo, DECODE(SUBSTR(SUM(WORKLOAD), 1, 1), '.', '0'||SUM(WORKLOAD), SUM(WORKLOAD)) AS WORKLOAD FROM ( SELECT subWorkOrderNo, (CASE WHEN subWorkState = 1 THEN 0 WHEN unit IN ('千米', '千米条') THEN ROUND(workLoad, 3) WHEN unit = '米' THEN ROUND(workLoad, 0) ELSE workLoad END) AS workLoad FROM ( SELECT LPCO.PROJECT_ID AS subWorkId, LPCO.PROJECT_NAME AS subWorkName, LPCO.PROJECT_CONTENT_ID AS subWorkContentId, LPCO.PROJECT_CONTENT AS subWorkContent, LPCO.IS_ZG AS subWorkType, LPCO.FLOW_ID AS subWorkOrderNo, LPCO.IS_ERROR AS subWorkState, LOR.WORKLOAD AS workLoad, LPC.UNIT AS unit FROM LINE_PROJECT_CHILD_ORDER LPCO INNER JOIN LINE_PROJECT_CODE LPC ON LPCO.PROJECT_CONTENT_ID = LPC.PROJECT_CONTENT_ID LEFT JOIN LINE_OPERATE_RECORD LOR ON LPCO.FLOW_ID = LOR.CHILD_FLOW_ID AND LOR.stateflag = 0 ) ) GROUP BY subWorkOrderNo ) db ON TO_CHAR(temp.SUBWORKORDERNO) = TO_CHAR(db.subWorkOrderNo) WHERE TO_NUMBER(temp.WORKLOAD) != TO_NUMBER(db.WORKLOAD) AND ROUND(temp.WORKLOAD, 3) != ROUND(db.WORKLOAD, 3) AND temp.SUBWORKORDERNO IN ( SELECT SUBWORKORDERNO FROM UIRMS.TEMP_LINE_EXCEL_WORK WHERE TO_NUMBER(WORKLOAD) != ( SELECT DECODE(SUBSTR(SUM(WORKLOAD), 1, 1), '.', '0'||SUM(WORKLOAD), SUM(WORKLOAD)) AS WORKLOAD FROM ( SELECT subWorkOrderNo, (CASE WHEN subWorkState = 1 THEN 0 WHEN
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复